创建挂载squashfs

创建挂载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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值