sys·ad·min·ol·o·gy [sis-ad-mih-nol-uh-jee]


  1. The scientific study of system administration and related phenomena.

Friday, 27 March 2015

Backing up ZFS file systems For People That Know LVM

Most of us use LVM on a regular basis, but ZFS (while not directly comparable) does share some useful snapshotting features. As I found out, the implementation is quite different! 

While setting up an appliance that required FreeBSD 9.3, I needed to some commands that would let me backup its ZFS file systems.

We already have hosts that use LVM snapshots, but in this instance ZFS was being used. Here's the "business end" of the backup script:

zfs snapshot tank0@backup

This creates a snapshot of all the volumes within tank0. Remember that ZFS can "group" partitions in this way. While the backup script could take this scatter gun approach, I decided on something a bit more surgical.

/sbin/mount | /usr/bin/grep tank0 | awk '{print $1}'

What that does is create a list of volumes within tank0 that are actually mounted (and therefore being used) There's no real downside to taking a snapshot of ALL the volumes in the tank, but be aware that you may need to allow for unformatted volumes.

Unlike LVM volumes, ZFS snapshots use the space within the existing file system, so you dont need to worry about there free space within the "volume group" (falling back on LVM terminology there!)

Another "handy" feature, is that we dont need to mount the snapshots, like we would an LVM snapshot. It available via a super hidden path in the root of each volume.

So lets say we took a snapshot of the root partition with the command above (zfs snapshot), then we can access that snapshot via 


Conversely, if we took a snapshot of the volume mounted at /var (zfs snapshot tank0/var@backup), then we could access the snapshot with 


Finally, once we've taken a snapshot of the volumes we want, we can simply rdiff-backup each one to a remote server:

rdiff-backup --create-full-path /.zfs/snapshot/backup/ backupuser@backuphost:/mnt/backups/

Now create a script to backup all the volumes you want, and then cron it for some horrible hour in the morning, so it can do its thing! And there we have it, a daily incremental backup of your ZFS file systems!


  1. We often lose data simply because we do not have proper workflow procedures and backup strategies. More efficient procedures for saving our work and making backups regularly will definitely save a lot of time for us.
    data room reviews

  2. Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”.
    visit website

  3. TopAssociate is a specialist provider of outsourced investment research and offshoring solutions for the global financial and investment community.
    Outsourced investment research