[OpenIndiana-discuss] Finding the "last" snapshot for a zfs volume

Discussion list for OpenIndiana openindiana-discuss at openindiana.org
Mon May 12 11:20:22 UTC 2014


On our backup servers I have a "backup-check" script that checks to see
what the last snapshot for a particular volume is (and compares it with the
current date)

df -F zfs -h |grep $mypool | nawk '{system("zfs list -t snapshot -r "$1" \|
tail -1")}' | egrep -v "$yesterday|no datasets"

okay, it's messy, but it should find the last snapshot for each zfs slice
within a pool.

However with the number of pools on the server increasing, and the number
of snapshots getting bigger every day, I was wondering if there is an
easier way of getting the latest snapshot than "zfs list -t snapshot -r
pool/snapshot | tail -1"

Any ideas would be helpful.

Jon


More information about the openindiana-discuss mailing list