How to modify squashfs image

简介: /********************************************************************** * How to modify squashfs image * 说明: * 本文如何使用squashfs-tools对squashfs image进行解压及合成。
/**********************************************************************
 *                  How to modify squashfs image
 * 说明:
 *     本文如何使用squashfs-tools对squashfs image进行解压及合成。
 *
 *                                    2016-4-27 深圳 南山平山村 曾剑锋
 *********************************************************************/

参考文档:
    How to modify squashfs image
        https://blog.sleeplessbeastie.eu/2012/05/27/how-to-modify-squashfs-image/


You cannot modify squashfs image directly but you can uncompress it, apply changes and compress it again.
你不能直接修改squashfs镜像,当时你可以解压他,然后修改文件,最后在压缩他。

Create temporary directory and enter it:
创建暂存文件夹,并进入:
    $ mkdir squashfs-temp
    $ cd squashfs-temp

To uncompress squashfs image (into squashfs-root directory) use unsquashfs command:
解压squashfs镜像(进入squashfs-root文件夹)使用unsquashfs命令:
    $ unsquashfs /live/image/livefs.squashfs 
    Parallel unsquashfs: Using 4 processors
    79505 inodes (89340 blocks) to write

    [===========================================================-] 89340/89340 100%
    created 72260 files
    created 9630 directories
    created 7245 symlinks
    created 0 devices
    created 0 fifos

After applying required changes you can compress it using mksquashfs command:
修改完你的需求之后,重新压缩并制作squashfs镜像:
    $ mksquashfs squashfs-root/ livefs.squashfs -noappend -always-use-fragments
    Parallel mksquashfs: Using 4 processors
    Creating 4.0 filesystem on livefs.squashfs, block size 131072.
    [===========================================================|] 82095/82095 100%
    Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
          compressed data, compressed metadata, compressed fragments, compressed xattrs
          duplicates are removed
    Filesystem size 1191282.88 Kbytes (1163.36 Mbytes)
          46.01% of uncompressed filesystem size (2589278.95 Kbytes)
    Inode table size 905038 bytes (883.83 Kbytes)
          29.51% of uncompressed inode table size (3066958 bytes)
    Directory table size 917125 bytes (895.63 Kbytes)
          44.02% of uncompressed directory table size (2083295 bytes)
    Number of duplicate files found 9152
    Number of inodes 89135
    Number of files 72260
    Number of fragments 6406
    Number of symbolic links  7246
    Number of device nodes 0
    Number of fifo nodes 0
    Number of socket nodes 0
    Number of directories 9629
    Number of ids (unique uids + gids) 19
    Number of uids 6
          root (0)
          daemon (1)
          milosz (1000)
          kdm (106)
          libuuid (100)
          man (6)
    Number of gids 17
          root (0)
          daemon (1)
          fuse (105)
          shadow (42)
          milosz (1000)
          vboxsf (104)
          tty (5)
          crontab (102)
          mail (8)
          mlocate (107)
          ssh (108)
          messagebus (106)
          nogroup (65534)
          utmp (43)
          utempter (112)
          staff (50)
          libuuid (101)

 

目录
打赏
0
0
0
0
12
分享
相关文章
Error copying image in the datastore: Not allowed to copy image file
opennebula error copying image in the datastore not allowed to copy image file Error copying image in the datastore: Not allowed to copy image file ...
1332 0
|
8月前
|
已解决:_tkinter.TcLError: couldn’t recognize data in image file “Image/nakamuraan.gif”
已解决:_tkinter.TcLError: couldn’t recognize data in image file “Image/nakamuraan.gif”
237 1
[Accessibility] Missing contentDescription attribute on image
[Accessibility] Missing contentDescription attribute on image
194 0
[Accessibility] Missing contentDescription attribute on image
glance image-create
glance image-create
1180 0
glance image-create --name "linux-core-mini-01" --file /cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --progress --visibili
glance image-create --name "linux-core-mini-01" --file /cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --progress --visibil...
1044 0
guestfish 修改 image file
Example guestfish sessionSometimes, you must modify a virtual machine image to remove any traces of the MAC addressthat was assigned to the virtual ne...
928 0
MGA (Managed Global Area) Reference Note (Doc ID 2638904.1)
MGA (Managed Global Area) Reference Note (Doc ID 2638904.1)
372 0
Create a Geometric Network and Set Flow Direction
几何网络是有向网络,是用来模拟现实中的如排水管,天然气管,电力等的网络。可是这个有向到底体现在哪里,原来以为以为集几何网络的方向是数字化的方向,但是我错了。我一般用几何网络做路径分析,我们知道,如果不强加限制,从A点到B点,那么,逆着原路走,也可以从B到A,这似乎体现不到方向,但是追中分析中,这种是很明显的。
853 0