Now that my hardware is selected and I have OpenSolaris installed, it’s time to set up the storage pool and automatic snapshots. I have four 750GB drives that I want to set up in a RAID-Z1 format, so a quick
format to find the drive identifiers, and we’re off to the races.
zfs create tank raidz c4d2t0 c4d3t0 c4d4t0 c4d5t0
I want to have three filesystems on tank: one for media (music, photos, movies, TV shows), one for Karen’s work, and one for backups. Initially, I wanted to create the backup as an iSCSI volume, but I had some problems with OpenSAN’s iSCSI initiator, and so, for now, I’ll just be using nfs to share all three filesystems.
The commands to set this up are very simple:
zfs create tank/Media zfs create tank/twiddle zfs create tank/backups
Since this file server won’t be doing much work besides just serving files, I have CPU cycles to spare. I’ll turn on compression, and, since this is a data store and not a place for programs, I will turn off setuid and exec.
zfs set compression=on tank zfs set setuid=off tank zfs set exec=off tank
Although all of the data in
tank is protected against a disk failure thanks to RAID-Z, I would still like to take snapshots of the data to get historical copies. This can be enabled very easily with the
zfs set com.sun:auto-snapshot=false rpool/ROOT svcadm enable svc:/system/filesystem/zfs/auto-snapshot:frequent svcadm enable svc:/system/filesystem/zfs/auto-snapshot:hourly svcadm enable svc:/system/filesystem/zfs/auto-snapshot:daily svcadm enable svc:/system/filesystem/zfs/auto-snapshot:weekly svcadm enable svc:/system/filesystem/zfs/auto-snapshot:monthly
The first line prevents the auto-snapshot service from taking snapshots of rpool/ROOT. The only reason I turn it off is because the services do not start successfully when older versions of the system exist but are not mounted (more details and another solution). Perhaps one of the best things about the auto-snapshot service is that it deletes old snapshots according to schedule.
I like Time Machine’s integration with the desktop, and, if at all possible, I want to keep using it. Unfortunately, my original plan of using an iSCSI share did not work out. For now, I set up a cron job to sync my home directory to my backups mount point every hour.
0 * * * * rsync -aH --inplace --numeric-ids --delete --ignore-errors --exclude=\.zfs --exclude=\.Trash --exclude=\.Spotlight-V100 --exclude=\.fseventsd /Users/john john_remote@fileserver:/tank/backups/ >>/Users/john/Dropbox/Documents/rsync_backup.log 2>&1
While not as elegant as Time Machine, when combined with the ZFS snapshots, it does offer the “oops I deleted that” protection I’m looking for. Eventually, I hope to find a good solution that allows me to use Time Machine again. The
--ignore-errors switch allows the delete to work even if an IO error occurs, and the
--exclude switches prevent backups of those specific directories (which I don’t have read access to anyway). Finally, I redirect any output to a file so I can check the status at any time.
Finally, I want to be able to easily check on the health of my file server. To do that, I set up a crontab on the file server to run a few commands and upload them to my web server. Now I can see my file server status from any Internet-connected computer.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
The thoughts expressed here are my own and do not necessarily represent those of my employer.