合并 mksquashfs 中预先存在的源文件夹

合并 mksquashfs 中预先存在的源文件夹

这个答案在上一个问题中,我发现了如何修改 squashfs 文件系统中的文件:

# unsquash the filesystem to a local directory
sudo cp /media/clonezilla/live/filesystem.squashfs ./
sudo unsquashfs filesystem.squashfs
# now, insert my own script which I want as part of the distribution
sudo cp ~/autobackup squashfs-root/usr/sbin/
# now, resquash the filesystem to be able to use it
sudo mksquashfs squashfs-root filesystem.squashfs -b 1024k -comp xz -Xbcj x86 -e boot

然而,在最后一行,我在制作文件系统时遇到了一些问题:

Source directory entry bin already used! - trying bin_1
Source directory entry dev already used! - trying dev_1
Source directory entry etc already used! - trying etc_1
Source directory entry home already used! - trying home_1
Source directory entry initrd.img already used! - trying initrd.img_1
Source directory entry lib already used! - trying lib_1
Source directory entry lib64 already used! - trying lib64_1
Source directory entry media already used! - trying media_1
Source directory entry mnt already used! - trying mnt_1
Source directory entry opt already used! - trying opt_1
Source directory entry proc already used! - trying proc_1
Source directory entry root already used! - trying root_1
Source directory entry run already used! - trying run_1
Source directory entry sbin already used! - trying sbin_1
Source directory entry selinux already used! - trying selinux_1
Source directory entry srv already used! - trying srv_1
Source directory entry sys already used! - trying sys_1
Source directory entry tmp already used! - trying tmp_1
Source directory entry usr already used! - trying usr_1
Source directory entry var already used! - trying var_1
Source directory entry vmlinuz already used! - trying vmlinuz_1

bin_1本质上,由于它覆盖现有的 squashfs 文件系统,因此它不会合并重复的文件,而是在名为、etc_1var_1tmp_1等的文件系统的根目录中创建新的文件夹和文件。

显然,这是不希望的。有没有办法强制它合并目录?我尝试使用 运行它-noappend,但这会破坏 Clonezilla 安装,并且我无法进入 Clonezilla 向导。有任何想法吗?

答案1

正如我在其他答案中所说,在将修改后的文件重新打包到新文件中之前,您必须将旧文件移动filesystem.squashfs到另一个位置(或重命名它):squashfs-rootfilesystem.squashfs

mv filesystem.squashfs /path/to/backup/

或者

mv filesystem.squashfs filesystem.squashfs.old

然后:

mksquashfs squashfs-root filesystem.squashfs -b 1024k -comp xz -Xbcj x86 -e boot

相关内容