Directory squasher for linux. Compresses directory with SquashFS and overlays it with OverlayFS.
Beside reasonable space savings, this tool provides also differential backups. During resquash and unmount the tool generates -diff.tar.gz files that contain all changes aplicable to main *.squashfs file. These files are not cumulative, so user needs to store each and every -diff.tar.gz file and their order, and/or copy full backup of the system since last resquash anytime.
First setup: squash -s
Maintenance: stop services; squash -r ; start services; upload -diff.tar.gz to backup server Uninstall: stop services; squash -u ; start services; upload -diff.tar.gz to backup serverThis tool is experimental, works well form me, but needs more testing
The script requires root privileges. Install it into /usr/local/bin and chmod +x
squash s <dir>
First time. I measured 31% compression ratio from 5G of emails with default gzip.
If the
.squashfs already exists, it just mounts it, so if you need to recompress, delete it.Replace
with actual path of your directory. After succesfull squashing:- Original directory will be renamed to .orig, can be deleted.
- Hidden file ..squashfs in parent dir will contain files in SquashFS
- Hidden directory ..base in parent dir will contain read-only files SquashFS
- Directory will be upper dir of OverlayFS and merged dir in one
squash r <dir>
Maintenance resquash, needs free space of size of new squash file. It is slower than first squash because it takes data from overlay, which has SquashFS decoding files in the lower layer.
While unmounted, this feature creates patch called
-diff.tar.gz, which can be used for backup purposes.squash u <dir>
Unmounts overlay and squash and creates patch.
- unmounts OverlayFS from
- unmounts SquashFS from ..base
- removes ..base (must be empty, if this fails, operation aborts)
- compresses now containing only changes into -diff.tar.gz relative to the parent dir
- removes
- renames .orig to , or if not exists unsquashes file ..squashfs into it (TBD, not yet implemented)