Am 21.02.2013 00:08, schrieb Mike Gerdts:
On Wed, Feb 20, 2013 at 4:49 PM, Markus Grundmann <> wrote:
Whenever I modify zfs pools or filesystems it's possible to destroy [on a
bad day :-)] my data. A new
property "protected=on|off" in the pool and/or filesystem can help the
administrator for datalost
(e.g. "zpool destroy tank" or "zfs destroy <tank/filesystem>" command will
be rejected
when "protected=on" property is set).

It's anywhere here on this list their can discuss/forward this feature
request? I hope you have
understand my post ;-)
I like the idea and it is likely not very hard to implement.  This is
very similar to how snapshot holds work.

# zpool upgrade -v | grep -i hold
  18  Snapshot user holds

So long as you aren't using a really ancient zpool version, you could
use this feature to protect your file systems.

# zfs create a/b
# zfs snapshot a/b@snap
# zfs hold protectme a/b@snap
# zfs destroy a/b
cannot destroy 'a/b': filesystem has children
use '-r' to destroy the following datasets:
# zfs destroy -r a/b
cannot destroy 'a/b@snap': snapshot is busy

Of course, snapshots aren't free if you write to the file system.  A
way around that is to create an empty file system within the one that
you are trying to protect.

# zfs create a/1
# zfs create a/1/hold
# zfs snapshot a/1/hold@hold
# zfs hold 'saveme!' a/1/hold@hold
# zfs holds a/1/hold@hold
NAME           TAG      TIMESTAMP
a/1/hold@hold  saveme!  Wed Feb 20 15:06:29 2013
# zfs destroy -r a/1
cannot destroy 'a/1/hold@hold': snapshot is busy

Extending the hold mechanism to filesystems and volumes would be quite nice.

Hi Mike! Yes that I have understand. zfs filesystems can protect on this way. With a new "protected" property the pool and the vdev's are lay under an additional security layer. We are all humans (that's good) but we are full with errors *lol*

The protection property helps to lock modification on the infrastructure of zfs. The pools. With a simple "zpool set protected=off <pool>" all modifications are available. The different is you must type as administrator additional command to unlock the pool for your next action. An example: In many linux distributions you will be ask "Sure?" when you type "rm *". That's fine or? zpool and zfs commands working without any warnings. Yes I was "root" but root is not god ;-)


zfs-discuss mailing list

Reply via email to