Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Forked from lxs137/mount_squashfs_rw.md
Created March 19, 2026 20:13
Show Gist options
  • Select an option

  • Save Ilgrim/95fa8eddc08098054638fb881a13590b to your computer and use it in GitHub Desktop.

Select an option

Save Ilgrim/95fa8eddc08098054638fb881a13590b to your computer and use it in GitHub Desktop.
Mounting a squashfs filesystem in read-write

FROM: https://unix.stackexchange.com/questions/80305/mounting-a-squashfs-filesystem-in-read-write

As root, copy filesystem.squashfs to some empty dir, e.g.:

    cp /mnt/clonezilla/live/filesystem.squashfs /path/to/workdir
    cd /path/to/workdir

Unpack the file then move it somewhere else (so you still have it as a backup):

    unsquashfs filesystem.squashfs
    mv filesystem.squashfs /path/to/backup/

Go in squashfs-root, add/modify as per your taste then recreate filesystem.squashfs:

    cd /path/to/workdir
    mksquashfs squashfs-root filesystem.squashfs -b 1024k -comp xz -Xbcj x86 -e boot

copy the newly created filesystem.squashfs over the existing one on your USB drive, e.g.:

    cp filesystem.squashfs /mnt/clonezilla/live/

then reboot and use your LIVE USB.

Note: the above commands are part of squashfs-tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment