4

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.

Vendetta V
  • 103
  • 1
  • 1
  • 7

2 Answers2

3

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
John Watts
  • 8,717
  • 1
  • 31
  • 35
Vendetta V
  • 103
  • 1
  • 1
  • 7
  • 1
    Trouble with this solution is, you have to have a crap-ton of space to be able to use `unsquashfs`. – MD XF Oct 08 '16 at 02:51
2

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