Hi! In some situation I did not feel good when I modify my zfs pools or filesystems structures. What do you think about the following "Extension"?
--Simulation--
Simulated output for filesystem properties:
----
My "problem" is when I remove snapshots from a filesystem the command syntax are identicaly for two reasons:
1) zfs destroy raid1p1/myimportantdata@snapshot <-- removes only my snapshot
2) zfs destroy raid1p1/myimportantdata <-- destroys my very important filesystem
Every day I manage the zfs filesystem and their snapshots within shell scripts. When this scripts have a bug and the '@'-symbol was not entered I can destroy my filesystem without any warnings. The same nightmare is possible for pool operations.
Do you understand what I meen? A simple "flag" or "property" can help me/us to protect the pool/filesystem when I have a bad day
Example: I will remove a snapshot but I have a syntax error in my command line. The property "protected" is set to "yes". Now I type [cmd=]zfs remove raid1p1/myimportantdata[/cmd] and then press enter. Zfs checks now the property and returns an error like
The same example is possible for pool operations. When I realy want to destroy a filesystem or pool first I must enter the following command:
[cmd=]zfs set protected=no|off raid1p1/myimportantdata[/cmd] or [cmd=]zpool set protected=off raid1p1[/cmd]
After this additional layer of "security" I can destroy the pool or filesystem.. What do you think about it? And sorry for my bad english ;-)
Best regards,
Markus
--Simulation--
Code:
[server ~]$ zpool get all raid1p1
NAME PROPERTY VALUE SOURCE
raid1p1 size 3.62T -
raid1p1 capacity 41% -
raid1p1 altroot - default
raid1p1 health ONLINE -
raid1p1 guid 14252030461883037602 default
raid1p1 version 28 default
raid1p1 bootfs - default
[color="DarkRed"]raid1p1 protected on local <-- new property[/color]
raid1p1 delegation on default
raid1p1 autoreplace off default
raid1p1 cachefile - default
raid1p1 failmode wait default
raid1p1 listsnapshots on local
raid1p1 autoexpand off default
raid1p1 dedupditto 0 default
raid1p1 dedupratio 1.00x -
raid1p1 free 2.13T -
raid1p1 allocated 1.50T -
raid1p1 readonly off -
raid1p1 comment - default
raid1p1 expandsize 0 -
Simulated output for filesystem properties:
Code:
[server ~]$ zfs get all raid1p1/myimportantdata
NAME PROPERTY VALUE SOURCE
raid1p1/myimportantdata type filesystem -
raid1p1/myimportantdata creation Sun Jan 27 23:47 2013 -
raid1p1/myimportantdata used 2.49T -
raid1p1/myimportantdata available 1.07T -
raid1p1/myimportantdata referenced 31K -
raid1p1/myimportantdata compressratio 1.01x -
raid1p1/myimportantdata mounted yes -
[color="DarkRed"]raid1p1/myimportantdata protected yes local <-- new property[/color]
raid1p1/myimportantdata quota none default
raid1p1/myimportantdata reservation none default
raid1p1/myimportantdata recordsize 128K default
...
My "problem" is when I remove snapshots from a filesystem the command syntax are identicaly for two reasons:
1) zfs destroy raid1p1/myimportantdata@snapshot <-- removes only my snapshot
2) zfs destroy raid1p1/myimportantdata <-- destroys my very important filesystem
Every day I manage the zfs filesystem and their snapshots within shell scripts. When this scripts have a bug and the '@'-symbol was not entered I can destroy my filesystem without any warnings. The same nightmare is possible for pool operations.
Do you understand what I meen? A simple "flag" or "property" can help me/us to protect the pool/filesystem when I have a bad day
Example: I will remove a snapshot but I have a syntax error in my command line. The property "protected" is set to "yes". Now I type [cmd=]zfs remove raid1p1/myimportantdata[/cmd] and then press enter. Zfs checks now the property and returns an error like
Code:
Operating failed. Filesystem is protected
The same example is possible for pool operations. When I realy want to destroy a filesystem or pool first I must enter the following command:
[cmd=]zfs set protected=no|off raid1p1/myimportantdata[/cmd] or [cmd=]zpool set protected=off raid1p1[/cmd]
After this additional layer of "security" I can destroy the pool or filesystem.. What do you think about it? And sorry for my bad english ;-)
Best regards,
Markus