日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

edHat linux光盘引导,[原]个性化Linux发行版光盘之补充——XZ(LZMA算法)

發(fā)布時間:2024/9/27 linux 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 edHat linux光盘引导,[原]个性化Linux发行版光盘之补充——XZ(LZMA算法) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

紅帽(Red Hat)從Enterprise Server 6.2 開始,啟動鏡像文件initrd.img 開始改用xz 工具進行壓縮,這與以往版本是有區(qū)別的。

一、啟動鏡像initrd.img 文件

類RedHat 系統(tǒng)從vmlinuz 核心引導后,會讀取initrd.img 啟動鏡像。該文件中包含驅(qū)動模塊等信息,是非常重要的文件。不同版本使用的格式不同。

1.RHEL 4.0 版本

采用ext2 文件格式鏡像,再通過gzip 壓縮:

引用

# file initrd.img

initrd.img: gzipcompressed data, from Unix, max compression

# mv initrd.img initrd.img.gz

# gunzip initrd.img.gz

# file initrd.img

initrd.img: Linux rev 1.0 ext2filesystem data

2.RHEL 5.0 版本

采用cpio 打包鏡像,再通過gzip 壓縮:

引用

# file initrd.img

initrd.img: gzipcompressed data, from Unix, max compression

# mv initrd.img initrd.img.gz

# gunzip initrd.img.gz

# file initrd.img

initrd.img: ASCII cpioarchive (SVR4 with no CRC)

3.RHEL 6.2 版本

RHEL 6.0 - 6.2 都采用與RHEL 5.0 相同的格式進行打包,但從6.2版本開始,改用LZMA進行壓縮。詳見:Release Notes for Red Hat Enterprise Linux 6.2 Edition 2。

如下:

引用

# file initrd.img

initrd.img: LZMAcompressed data, streamed

※ 注意,若在低于RHEL 6.2 版本下執(zhí)行file命令,可能無法識別LZMA 壓縮格式:

引用

# file initrd.img

initrd.img: data

這時,可把file軟件包升級到5.04-13.el6 即可。

二、xz 工具簡介

xz 工具是LZMA 壓縮算法的一個實現(xiàn)。具體可見:Wikipedia

引用

xz is a lossless data compression file format incorporating the LZMA2compression algorithm. While xz can only support one file the convention is to bundle a file that is an archive itself, such as those created by the tar or cpio Unix programs. The original 7zip program implementing LZMA2 compression achieved small files (at the cost of speed compared to gzip or bzip2), but also created its own unique archive format which was Windows-centric and did not support Unix functionality; xz is essentially a stripped down 7zip with little archive format functionality, that compresses a single file (as opposed to 7zip's more complex capabilities like concatenating & compressing entire directories).

7-Zip supports xz since version 9.04 beta (stable since 9.20)

可見,Windows 下可使用7-Zip 打開.xz 文件。LZMA 算法比Gzip 算法壓縮率更高。幾個參數(shù):

引用

# xz --help

Usage: xz [OPTION]... [FILE]...

Compress or decompress FILEs in the .xz format.

Mandatory arguments to long options are mandatory for short options too.

-z, --compress??????force compression

-d, --decompress????force decompression

-t, --test??????????test compressed file integrity

-l, --list??????????list information about files

-k, --keep??????????keep (don't delete) input files

-f, --force???????? force overwrite of output file and (de)compress links

-c, --stdout????????write to standard output and don't delete input files

-0 .. -9????????????compression preset; 0-2 fast compression, 3-5 good

compression, 6-9 excellent compression; default is 6

-e, --extreme?????? use more CPU time when encoding to increase compression

ratio without increasing memory usage of the decoder

三、手動修改initrd.img 文件

解壓:

# xz -dc initrd.img | cpio -id

壓縮:

# find . | cpio -c -o | xz -9 --format=lzma > initrd.img

三、補充tar.lzma

由于LZMA具有優(yōu)秀的壓縮率及占用資源少的特點,越來越多的工具采用lzma進行打包,后綴名為:tar.lzma。

對于Fedora 11 及以后的版本,可以使用下面的命令操作:

壓縮

# tar cfv backup.tar.lzma a/dir --lzma

解壓:

# tar xfv backup.tar.lzma --lzma

如果是CentOS 5.3 等老版本,需要安裝獨立的lzma 工具或用xz 進行:

壓縮:

# tar cv a/dir | lzma -c -z > backup.tar.lzma

解壓(兩個方式都可以):

# cat backup.tar.lzma | lzma -d | tar xv

# xz -dc backup.tar.lzma | tar xvf -

參考自:Working with lzma tarballs

※ 2013-04-27 添加tar.lzma 的處理方法

總結(jié)

以上是生活随笔為你收集整理的edHat linux光盘引导,[原]个性化Linux发行版光盘之补充——XZ(LZMA算法)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。