I have a squashfs image file that I copied from a bootable iso file. When mounting the file, it always mounts it read-only.

Is it possible to directly edit the content without extracting the squashfs image first, or is it possible to mount squashfs images read-write?

  • 2
    no. and no. you could mount it r/o, and afterward mount an overlay over it so you can have the semblance of a r/w fs based on an sfs image, but the archive will not change, and when it is eventually umounted it will be the same archive it was before. – mikeserv Oct 25 '15 at 13:51

It is possible to modify a squashfs image without extracting its contents, but there are limitations. If you specify an existing squashfs image as the destination parameter for mksquashfs, without specifying the -noappend option, it will attempt to add additional files from the specified source parameters. It appears that mksquashfs attempts to generate a new name if it encounters a conflict, which is probably not what you want if the goal is to edit files in place.

In principle, mksquashfs could allow files to be replaced (and preserve the name in the process) in append mode, but the version I'm using , mksquashfs version 4.3-git (2014/06/09) (from the current debian package in sid), doesn't seem to allow that. It should be possible to make arbitrary incremental changes to a squashfs image, with the right code (file deletions might not be space efficient, if they merely orphan existing blocks, and existing file offsets are reused, and new data is appended), but that seems unlikely to work well on a mounted image (you'd need to unmount the image before modifying it, and remount it afterward).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.