How do I write to/make changes to an existing squashfs filesystem?

15k Views Asked by At

How do I write to/make changes to an existing squashfs filesystem? I have tried using aufs/unionfs, but these require kernel modules that are extremely hard to compile.

2

There are 2 best solutions below

1
On

Do not use aufs/unionfs. On a Fedora system for example, install squashfs-tools by doing

#yum install squashfs-tools

This will get you /sbin/mksquashfs and /usr/sbin/unsquashfs installed on your host machine. Use these to uncompress an existing squashfs, make changes, and then compress it back again. Like so....

#ls rfs.squashfs 
#unsquashfs rfs.squashfs 
#ls rfs.squashfs squashfs 

Now make changes

#cd squashfs
#mkdir etc/vector

And compress it back

#mksquashfs squashfs my-new-squashfs
0
On

Using (mk|un)squashfs you may loose original permissions, compression type and so on. So, use unsquashfs -s to determine useful options. Also, you may mount -o loop -t squashfs to review fs PS: sorry, can't comment