Skip to content
A backup program employing the use of SquashFS, Aufs and Rsync
Shell Makefile
Branch: master
Clone or download
Pull request Compare This branch is 14 commits ahead of falconindy:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Makefile Makefile: remove superfluous lines -- use install instead of mkdir/cp… Aug 26, 2010



squashfu - an incremental backup solution (updated version for CIRCL TR-55)


squashfu <action> [options]


squashfu is a Bash based backup utility that uses the flexibility of rsync, squashfs, and aufs to create incremental backups and offer limited compression.



Runs a regular backup, using the config file at /etc/squashfu.


Create a new squashed seed by merging old bins. This will leave you with a no more than the number of bins specified by the MIN_BINS setting in the config.


Delete the incremental backup with the number BIN. This is done interactively and you will have a chance to confirm before any files are deleted.

-G path

Directly restore a file or directory. This is an interactive operation and a list of locations where the target is found will be presented.


Displays usage statistics, including the size of the compressed seed and each incremental backup with its creation date and bin number.

-R <number of bins>

Rollback specified number of backups and mount union for browsing. The rolled back data will be mounted at $UNION_MOUNT.


Unmount the squash and union. Although squashfu will always check and unmount as necessary before an operation, this is provided as a convenience.



Specify an alternate config file as denoted by PATH. The default config will still be sourced, but options specified in this config will override the defaults. If your extra config overrides the location of the backups, ensure that this config is always passed for any operation.


Execute pre and post hooks during operations. If this is a standard operation, it can be set in the configuration file via `HOOKS=true`


Goal: To create a backup solution which provides incremental backups and compression, and which also provides an easy way to roll back.


A directory structure is created as follows (with some terminology included):

     |- seed.sfs  <-- squash, or seed
     |- ro/       <-- squash mount point
     |- rw/       <-- union mount point
     |- .bins/    <-- incrementals
         | .....
         | .....
         | .....
         | .....
         | .....

     |- lib/
        |- .squashfu.inv <-- bin inventory list (or binventory)

seed.sfs is created from an initial backup and compressed using SquashFS, which is simply a read only filesystem which focuses on compression. It's mounted, using a loopback device, on ro/.

At the time of the backup, the next available bin is determined, created, and logged to an inventory sheet with a timestamp. A union is created with all the available bins, mounted in reverse chronological order on top of the seed (newest to oldest) on rw/. At this point, the union represents the state of your files at the end of the last backup. The newest branch is marked as read/write, and rsync is called. Because this top branch is the only writable location in the union, the files rsync generates with the -u (update) flag are placed into this branch. The backup finishes, and the union and seed are unmounted.

At this point, Squashfu ensures compliance with the user's settings of MAX_BINS. If the current number of used bins exceeds this value, a new seed is generated. The number of old incrementals merged into the new seed is determined by the difference between MAX_BINS and MIN_BINS in the config file. In this way, you always have MIN_BINS available to roll back to, but you're not forced to recompress your seed at every backup -- an operation that may take a long time depending on how big your backup source is.

If and when you want to roll back, execute Squashfu with the -R action, and supply the number of bins you want to roll back. The bins are ordered chronologically, and the oldest "number_of_bins - bins_to_rollback" are mounted on the union mount point.

WARNING: You should not, under any circumstances, add or remove files contained in the bins, nor should you alter your binventory's time stamps. Doing so many result in your cat being set on fire or your backups being destroyed.


~ On Arch Linux, build and install from the AUR.

~ On other distributions, use the included Makefile to run make install, ensuring that the DESTDIR and MANPREFIX are specified.

~ Read over each option in /etc/squashfu.conf and set it accordingly.

~ Create your first backup with squashfu -B and validate that the backup was created successfully.

~ It may be a wise idea to make more changes, run a new backup and inspect the resulting incremental.



aufs(5), rsync(1)


Dave Reisner <>


Sascha Rommelfangen <>

You can’t perform that action at this time.