创建挂载squashfs
创建
mksquashfs /some/dir dir.sqsh
挂载
mount dir.sqsh /mnt/dir -t squashfs -o loop
设备上创建
mksquashfs /some/dir /dev/fd0
挂载设备
mount /dev/fd0 /mnt/floppy -t squashfs
基于/etc/fstab挂载
/var/arch.sqsh /var/arch squashfs ro,defaults 0 0
排除虚拟文件系统
use the -e option for mksquashfs to exclude all pseudo-filesystems such as /proc, /sys (on linux kernels after 2.5.x) and /dev (when using DevFS)
mksquashfs floppylinux root.sqsh -e proc
Squashed file systems on CD-ROMs
1.Enable SquashFS in the linux kernel of the target system
2.Create a squashed root file system
3.Modify the /etc/fstab or startup scripts of the target system to mount the squashd file system when you need it
构建可读写文件系统
Create the ro.fs squashed file system and the rw.fs dir
mksquashfs /home/user1 ro.fs
mkdir /home/rw.fs
先挂载不可写的squashfs
mount -t squashfs ro.fs /mnt -o loop
再挂载unionfs文件系统
mount the unionfs file system, that makes /mnt and /home/rw.fs apparently merged under /home/user1 location.
合并挂载mnt和rw.fs文件夹到user1目录
mount -t unionfs -o dirs=rw.fs=rw:/mnt=ro unionfs user1
切换到最终可读写的根文件系统
cd /realroot/mnt/Image
chroot target /bin/sh
参考链接:
https://blog.csdn.net/u013566722/article/details/52494824
https://www.cnblogs.com/zhishuai/p/8205229.html
https://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html
https://www.unix.com/man-page/FreeBSD/8/mount_unionfs/
https://unionfs.filesystems.org/
https://cloud.tencent.com/developer/article/1518056
https://www.cnblogs.com/pengdonglin137/p/3521408.html
https://blog.csdn.net/qq_15770331/article/details/97000866
https://unix.stackexchange.com/questions/209920/squashfsunionfs-as-root-filesystem