Create zfs snapshot and back it up
January 18, 2008 4:22 pm Solaris ZFSTime to get some backups going of the zfs file systems.
anouk:/work/scripts # zfs list
NAME USED AVAIL REFER MOUNTPOINT
storage 23.0G 43.4G 31.5K /storage
storage/backup 1.32G 43.4G 1.32G /storage/backup
storage/crash 24.5K 43.4G 24.5K /storage/crash
storage/mp3 14.2G 43.4G 14.2G /storage/mp3
storage/stuff 7.47G 43.4G 7.47G /storage/stuff
storage/zones 24.5K 43.4G 24.5K /storage/zones
Let’s start with the /storage/backup file system.
anouk:/work/scripts # zfs snapshot storage/backup@080118
anouk:/work/scripts # zfs list
NAME USED AVAIL REFER MOUNTPOINT
storage 23.0G 43.4G 31.5K /storage
storage/backup 1.32G 43.4G 1.32G /storage/backup
storage/backup@080118 0 - 1.32G -
storage/crash 24.5K 43.4G 24.5K /storage/crash
storage/mp3 14.2G 43.4G 14.2G /storage/mp3
storage/stuff 7.47G 43.4G 7.47G /storage/stuff
storage/zones 24.5K 43.4G 24.5K /storage/zones
temp 23.0G 10.2G 23.0G /temp
It’s that easy. Any changes will be tracked to the snapshot so i can restore it to this point at any time i choose.
Now to send it to another system for redundancy:
anouk:/storage # zfs send storage/backup@080118 | ssh augustus zfs recv backup/anouk-backup
For the above command to work on the system augustus the zpool backup has to exist but the file system i am sending the snapshot to may not exist.
There, all done. I have a backup of the file system anouk:/storage/backup at augustus:/backup/anouk-backup
augustus:/backup # zfs list
NAME USED AVAIL REFER MOUNTPOINT
backup 1.32G 6.24G 26.5K /backup
backup/anouk-backup 1.32G 6.24G 1.32G /backup/anouk-backup
backup/anouk-backup@080118 0 - 1.32G -
Consult the zfs administration guide for more info on cloning snapshots as well.