4

In this answer on a previous question, I found out how to modify files in a squashfs filesystem:

# 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

However, on that last line, I run into some problems making the filesystem:

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

Essentially, since it's overwriting an existing squashfs filesystem, instead of merging duplicate files, it creates new folders and files in the root of the filesystem named bin_1, etc_1, var_1, tmp_1, etc.

Obviously, this is not desired. Is there a way that I can force it to merge the directories? I have attempted to run it with -noappend, but that breaks the Clonezilla install and I can't get into the Clonezilla wizard. Any ideas?

Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311

1 Answers1

4

As I said in my other answer you have to move the old filesystem.squashfs to another location (or rename it) before repacking your modified squashfs-root into a new filesystem.squashfs:

mv filesystem.squashfs /path/to/backup/

or

mv filesystem.squashfs filesystem.squashfs.old

then:

mksquashfs squashfs-root filesystem.squashfs -b 1024k -comp xz -Xbcj x86 -e boot
don_crissti
  • 79,330
  • 30
  • 216
  • 245