nilFM
design and programming portfolio of Derek Stevens: drkste@zoho.com

Kyanite: the simple incremental backup system

Kyanite is what I consider to be the most streamlined UNIX-style backup solution available. In true UNIX fashion, it aims to be simple, powerful, and composable; I think it does all three well.

Kyanite arose from my needing a regular and portable backup solution that required little to no maintenance and didn't have the expensive and stressful setup that tools like backuppc and rsnapshot have.

Ultimately, Kyanite is a wrapper around rsync, as are both of the aforementioned tools as well. But where other tools pack a million features in, Kyanite keeps it simple, instead reaching for composability over completeness.

You invoke Kyanite like so:

# kyanite.sh full /home/ /mnt/

The above would make a full backup of the directory /home/ under an organizational directory structure inside of /mnt/; The organizational structure goes like:

/rootPath/host/timestamp_mode/

In the above run, rootPath is of course /mnt/ and mode is full.

You can also backup or restore to remote locations:

# kyanite.sh partial nilix@nilfm.cc:/var/www/ /media/backups/

would store the backup in /media/backups/nilfm.cc/{timestamp}_part/;

Incremental/partial backups use the `--link-dest` option to rsync, so files that are unchanged from the latest full backup for that host are hardlinked to their counterparts in that backup, saving that precious space, time, and bandwidth.

Restores are dead simple, just do

# kyanite.sh restore /media/oldspam/2020-01-01_23:42_part/ /home/

or something like that, and let it rip.

Additional options at the end of the command are passed to rsync as well if you need any more advanced behavior:

# kyanite.sh full /home/nilix/ /media/cryo/ --exclude .cache

The simple and easy-to-remember syntax lends itself well to both on-demand and automated backups. You can type a quick line in your terminal, forget about it and go to bed, or you can stick it in a cronjob likewise.

Kyanite is not without caveat, for example it expects you to be backing up the same single directory tree every time. You could bypass this by creating separate directories in your backup medium but it's not an ideal solution since it inverts the level of organization (ie, what should be

/backup/host/tree/timestamp_mode/

is instead

/backup/tree/host/timestamp_mode/

It wouldn't be too hard to fix, but it works well for my purposes now, so implementing a solution for this shortcoming isn't on my short list.

Anyways, I hope some other nerd finds this little script useful, as for many cases where you want incremental backups the enterprise level tools like backuppc and rsnapshot are overkill, but you want something more polished than an alias in your bash profile. Combine this with a daemon like cron and a ZFS software RAID storage server and you've got yourself a pretty solid backup system.

Lacking access to that type of technology, I write my backups on used napkins!