none
分类: LINUX
2015-11-06 11:40:58
From
1、普通squashfs文件解压缩及查看
(1) 可使用unsuqashfs命令直接解压缩。
[root@localhost squashfs]# unsquashfs squashfs.img
(2)也可mount到临时目录
[root@localhost squashfs]# mount -o loop squashfs.img -t squashfs temp/
2、XZ算法压缩后的squashfs.img解压缩与查看
下载Fedora 15 Live CD后,尝试解压缩ISO中的squashfs.img文件,发现无法mount,也无法通过unsquashfs命令解压缩。提示“Filesystem uses xz compression, this is unsupported by this version”。但下载到的最新squashfs 4.2版本,提示XZ压缩算法的。
[root@localhost ~]# mount -o loop /boot/Fedora-15-x86_64-Live-Desktop.iso /mnt/
[root@localhost ~]# ls /mnt/
EFI GPL isolinux LiveOS
[root@localhost ~]# cd /mnt/LiveOS/
[root@localhost LiveOS]# ls
livecd-iso-to-disk osmin.img squashfs.img
[root@localhost squashfs]# file squashfs.img
squashfs.img: Squashfs filesystem, little endian, version 4.0, 578519788 bytes, 3 inodes, blocksize: 131072 bytes, created: Fri May 13 15:49:05 2011
[root@localhost squashfs]# mount -o loop squashfs.img -t squashfs temp/
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog – try
dmesg | tail or so
[root@localhost squashfs]#
[root@localhost squashfs]# unsquashfs squashfs.img
Filesystem uses xz compression, this is unsupported by this version
Decompressors available:
gzip
下载最新的squashfs工具,发现Makefile有个选项,“#XZ_SUPPORT = 1”,选择打开XZ_SUPPORT=1,保存退出。重新编译后,就可以解压缩使用XZ算法压缩的squashfs.img文件了。
[root@localhost squashfs]#
########### Building XZ support #############
#
# LZMA2 compression.
#
# XZ Utils liblzma () is supported
#
# To build using XZ Utils liblzma – install the library and uncomment
# the XZ_SUPPORT line below.
#
#XZ_SUPPORT = 1
[root@localhost squashfs-tools]# make clean && make && make install
[root@localhost squashfs]#
[root@localhost squashfs]# unsquashfs squashfs.img
Parallel unsquashfs: Using 16 processors
1 inodes (32768 blocks) to write
[= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = /] 32768/32768 100%
created 1 files
created 2 directories
created 0 symlinks
created 0 devices
created 0 fifos
k_ewell2015-11-06 11:45:16
# LZMA2 compression.
#
# XZ Utils liblzma (http://tukaani.org/xz/) is supported
#
# To build using XZ Utils liblzma - install the library and uncomment
# the XZ_SUPPORT line below.
#
XZ_SUPPORT = 1
# To build using XZ Utils liblzma - install the library and uncomment
# the LZMA_XZ_SUPPORT line below.
#
# To buil