How to check that all ZFS snapshots within a pool are without holds before destroying that pool

Posted by Graham Perrin on Server Fault See other posts from Server Fault or by Graham Perrin
Published on 2012-12-08T09:13:07Z Indexed on 2012/12/08 11:14 UTC
Read the original article Hit count: 416

Filed under:
|

Question

Already I can check each snapshot of a filesystem individually, manually.

I would prefer to check all at once (all with a single command or script). Please:

  • can that be done with a script?

Background

From the man page for zfs(8):

zfs holds [-H] [-r] snapshot…

… -r Specifies that a hold with the given tag is applied recursively to the snapshots of all descendent file systems.


I wondered whether recent snapshots are treated as descendants of older snapshot. No:

Last login: Sat Dec  8 09:02:26 on ttys003
macbookpro08-centrim:~ gjp22$ zfs holds -r gjp22@2012-12-08-081957
NAME                     TAG  TIMESTAMP
macbookpro08-centrim:~ gjp22$ zfs holds -r gjp22@2012-10-28-212255
NAME                     TAG                                           TIMESTAMP
gjp22@2012-10-28-212255  problem with LocalStorage for WOT for Safari  Mon Oct 29  6:44 2012
macbookpro08-centrim:~ gjp22$ zfs hold experiment gjp22@2012-12-08-081957
macbookpro08-centrim:~ gjp22$ zfs holds -r gjp22@2012-10-28-212255
NAME                     TAG                                           TIMESTAMP
gjp22@2012-10-28-212255  problem with LocalStorage for WOT for Safari  Mon Oct 29  6:44 2012
macbookpro08-centrim:~ gjp22$ zfs holds -r gjp22@2012-12-08-081957
NAME                     TAG         TIMESTAMP
gjp22@2012-12-08-081957  experiment  Sat Dec  8  9:04 2012
macbookpro08-centrim:~ gjp22$ zfs holds -r gjp22@2012-10-28-212255
NAME                     TAG                                           TIMESTAMP
gjp22@2012-10-28-212255  problem with LocalStorage for WOT for Safari  Mon Oct 29  6:44 2012
macbookpro08-centrim:~ gjp22$ 

© Server Fault or respective owner

Related posts about scripting

Related posts about zfs