leah blogs

July 2013

14jul2013 · Summer of Scripts: rdumpfs, dailydump, yday

One of the best Plan 9 features is the dump file system, a nightly snapshot of the filesystem. I use a similar scheme to backup my own machines: Everyday, I run a script dailydump which runs my rdumpfs wrapper around rsync to create a snapshot of my notebook SSD to the hard disk. Files are compared to yesterday’s revision and hardlinked in case they did not change. This makes backups pretty efficient: I snapshot the whole filesystem and the dump increases only by around 250 to 400 MB daily. (That contains all system package updates.) I keep the last month of daily dumps on the machine and later put them to my home RAID for archival. I keep a monthly copy on my notebook as well.

Since rdumpfs supports backing up to and from remote machines, I also use this to backup various machines on my home network that don’t have enough local disk space for a dump.

The tool yday is akin to Plan 9’s yesterday and can be used to compute old file names in the dump. For example, to list all available versions of my .zshrc that are older than 100 days:

% yday -a -n 100 ~/.zshrc
/dump/2013/0401/home/chris/.zshrc
/dump/2013/0314/home/chris/.zshrc
/dump/2013/0301/home/chris/.zshrc
/dump/2013/0214/home/chris/.zshrc
/dump/2013/0201/home/chris/.zshrc
/dump/2013/0114/home/chris/.zshrc
/dump/2013/0101/home/chris/.zshrc
/dump/2012/1231/home/chris/.zshrc
/dump/2012/1207/home/chris/.zshrc

This tool saved my files a few times already. :)

(Another benefit: When some package breaks, I can fiddle with $PATH and $LD_LIBRARY_PATH and almost transparently run old programs against old libaries.)

NP: Molotow Soda—Everything

Copyright © 2004–2022