zfs snapshot management

a.smith at ukgrid.net a.smith at ukgrid.net
Mon Jun 6 19:06:09 UTC 2011


Hi Charles,

   I have written some Bash scripts that manage my snapshots via  
crontab and can also replicate the snapshots to a remote server via  
Ssh. The scripts do:

*Run snapshot, (can be once a day, once an hour etc to meet system  
requirements).
Snapshot type is weekly if run at 00h on Sunday, Monthly if run at 00h  
on the first of the monthly, otherwise is "regular" snapshot.

*Regular snapshots are deleted after X weeks (X configurable as  
command argument)

*Weekly snapshots are deleted after 1 year

*Monthly snapshots are never automatically removed

*Weekly and Monthly snapshots are optional, ie used if defined by  
command arguments.

*If replication is used data is sent via Ssh, either directly piped  
into zfs receive or sent as a file which can be read in via another  
script at a later date (useful if you are paranoid and want the  
secondary ZFS to be some hours behind the primary).

*Data is sent via non-root user for security. User must be given the  
relevant ZFS privileges.

*Snapshots are pruned on both source and destination servers.



I haven't published the scripts as I haven't put all the polish onto  
them that I think they would need. But they work as described above  
and are reliable, I can pass you a copy if they are of interest,

cheer Andy.





More information about the freebsd-fs mailing list