I would like to request an additional flag for the command line zfs tools. Specifically, I''d like to have a -t flag for "zfs destroy", as shown below. Suppose I have a pool "home" with child filesystem "will", and a snapshot "home/will at yesterday". Then I run the following commands: # zfs destroy -t volume home/will at yesterday zfs: not destroying home/will at yesterday, as it is not a volume. # zfs destroy -t snapshot home/will at yesterday (succeeds) # zfs destroy -t snapshot home/will zfs: not destroying home/will, as it is not a snapshot. # zfs destroy -t volume home/will zfs: not destroying home/will, as it is not a volume. # zfs destroy -t filesystem home/will (succeeds) Now, to test the behavior of ''-r'', I recreate the same structure as before, and run some more commands: zfs destroy -r -t snapshot home (succeeds) zfs list -Hro name home home/will One more time, to demonstrate -R: zfs clone home/will at yesterday home/oldwill zfs destroy -R -t snapshot home (???) The two ways I can think of at this point are to destroy the clone as well, or to promote it and then destroy the snapshots. Or, I suppose, make -R incompatible with -t for zfs destroy. I imagine this would be easy to implement, and for scripting use it would be a good sanity check; if you''re trying to clean up snapshots you don''t accidentally kill the filesystems by messing up some string operation and naming a valid filesystem by mistake. Especially with -r, this could prevent silly mistakes. Also, it might be a helpful thing to add to ''zfs get''; if one wants to see some property for all user home directories and not the snapshots of them, syntax like zfs get used -r -t filesystem home could list the "used" property of all the children of the home filesystem. This is a slightly different semantic from the proposed "zfs destroy" enhancement: it''s a filter rather than a predicate. I think this is the Right Thing to do with this flag, and it will be intuitive for users. Any suggestions on better specifying the behavior? How can I formally propose this? I''d be glad to implement it if would help this get finished. Thanks! Will
> zfs destroy -t flagThumbs up for this. Plus asking for an -i flag, for interactive mode, handy on things like zfs destroy. -mg
http://www.opensolaris.org/bug/report.jspa You''ll need an OpenSolaris.org account to file the RFE of course. On Jul 17, 2008, at 10:52 AM, Will Murnane wrote:> I would like to request an additional flag for the command line zfs > tools. Specifically, I''d like to have a -t flag for "zfs destroy", as > shown below. Suppose I have a pool "home" with child filesystem > "will", and a snapshot "home/will at yesterday". Then I run the > following commands: > # zfs destroy -t volume home/will at yesterday > zfs: not destroying home/will at yesterday, as it is not a volume. > # zfs destroy -t snapshot home/will at yesterday > (succeeds) > # zfs destroy -t snapshot home/will > zfs: not destroying home/will, as it is not a snapshot. > # zfs destroy -t volume home/will > zfs: not destroying home/will, as it is not a volume. > # zfs destroy -t filesystem home/will > (succeeds) > > Now, to test the behavior of ''-r'', I recreate the same structure as > before, and run some more commands: > zfs destroy -r -t snapshot home > (succeeds) > zfs list -Hro name > home > home/will > > One more time, to demonstrate -R: > zfs clone home/will at yesterday home/oldwill > zfs destroy -R -t snapshot home > (???) > The two ways I can think of at this point are to destroy the clone as > well, or to promote it and then destroy the snapshots. Or, I suppose, > make -R incompatible with -t for zfs destroy. > > I imagine this would be easy to implement, and for scripting use it > would be a good sanity check; if you''re trying to clean up snapshots > you don''t accidentally kill the filesystems by messing up some string > operation and naming a valid filesystem by mistake. Especially with > -r, this could prevent silly mistakes. > > Also, it might be a helpful thing to add to ''zfs get''; if one wants to > see some property for all user home directories and not the snapshots > of them, syntax like > zfs get used -r -t filesystem home > could list the "used" property of all the children of the home > filesystem. This is a slightly different semantic from the proposed > "zfs destroy" enhancement: it''s a filter rather than a predicate. I > think this is the Right Thing to do with this flag, and it will be > intuitive for users. > > Any suggestions on better specifying the behavior? How can I formally > propose this? I''d be glad to implement it if would help this get > finished. > > Thanks! > Will > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
On Thu, Jul 17, 2008 at 17:05, Chad Lewis <Chad.Lewis at sun.com> wrote:> http://www.opensolaris.org/bug/report.jspa > > You''ll need an OpenSolaris.org account to file the RFE of course.Thanks for the link. I''ve filed an RFE, but don''t see it yet; is there a better way than "text search for things I put in the bug" that I can check on the status of this bug? Will
Will Murnane wrote:> On Thu, Jul 17, 2008 at 17:05, Chad Lewis <Chad.Lewis at sun.com> wrote: >> http://www.opensolaris.org/bug/report.jspa >> >> You''ll need an OpenSolaris.org account to file the RFE of course. > Thanks for the link. I''ve filed an RFE, but don''t see it yet; is > there a better way than "text search for things I put in the bug" that > I can check on the status of this bug?when it does show up on bugs.opensolaris.org (in perhaps 24 hours time), it''ll be 6727026 -t flag for ''zfs destroy'' James C. McPherson -- Senior Kernel Software Engineer, Solaris Sun Microsystems http://blogs.sun.com/jmcp http://www.jmcp.homeunix.com/blog