使用squashfs工具解压并创建的 squashfs.img文件

使用squashfs工具解压并创建的 squashfs.img文件

使用squashfs工具解压并创建的 squashfs.img文件_第1张图片

文章来自 使用squashfs工具解压并创建的 squashfs.img文件 - 知乎 (zhihu.com)

1.安装工具

[root@localhost ~]# yum install -y squashfs-tools

2.用unsuqashfs命令直接解压缩squashfs.img

[root@localhost ~]# unsquashfs squashfs.img
Parallel unsquashfs: Using 48 processors
1 inodes (16384 blocks) to write

[====================================================================================================================================================================================-] 16384/16384 100%

created 1 files
created 2 directories
created 0 symlinks
created 0 devices
created 0 fifos

3.挂载文件系统

[root@localhost ~]# cd squashfs-root/LiveOS/
[root@localhost LiveOS]# mount rootfs.img /mnt/rootfs/
[root@localhost LiveOS]# ls /mnt/rootfs/
bin  boot  dev  etc  firmware  lib  lib64  lost+found  mnt  modules  proc  root  run  sbin  sys  tmp  usr  var

4.根据需要可以修改/mnt/rootfs目录下文件

5.修改后重新打包

[root@localhost ~]# mksquashfs squashfs-root/ squashfs.img -comp xz -Xbcj x86 -e boot
Parallel mksquashfs: Using 48 processors
Creating 4.0 filesystem on squashfs.img, block size 131072.
[====================================================================================================================================================================================-] 16384/16384 100%

Exportable Squashfs 4.0 filesystem, xz compressed, data block size 131072
        compressed data, compressed metadata, compressed fragments, compressed xattrs
        duplicates are removed
Filesystem size 442739.12 Kbytes (432.36 Mbytes)
        21.11% of uncompressed filesystem size (2097216.44 Kbytes)
Inode table size 23442 bytes (22.89 Kbytes)
        35.69% of uncompressed inode table size (65690 bytes)
Directory table size 58 bytes (0.06 Kbytes)
        100.00% of uncompressed directory table size (58 bytes)
Xattr table size 55 bytes (0.05 Kbytes)
        100.00% of uncompressed xattr table size (55 bytes)
Number of duplicate files found 0
Number of inodes 3
Number of files 1
Number of fragments 0
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 2
Number of ids (unique uids + gids) 1
Number of uids 1
        root (0)
Number of gids 1
        root (0)

你可能感兴趣的:(linux,运维,服务器)