Clonezilla

合併 mksquashfs 中預先存在的源文件夾

  • June 23, 2013

在上一個問題的答案中,我發現瞭如何修改 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

本質上,由於它覆蓋了現有的 squashfs 文件系統,而不是合併重複文件,它會在名為bin_1etc_1var_1tmp_1等的文件系統的根目錄中創建新文件夾和文件。

顯然,這是不希望的。有沒有辦法可以強制它合併目錄?我曾嘗試使用 執行它-noappend,但這會破壞 Clonezilla 安裝,我無法進入 Clonezilla 嚮導。有任何想法嗎?

正如我在另一個答案中所說,您必須先將舊的移動filesystem.squashfs到另一個位置(或重命名),然後才能將修改後squashfs-root的內容重新打包到新的位置filesystem.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

引用自:https://unix.stackexchange.com/questions/80447