openzfs/zfs

"zpool labelclear" should only clear valid labels

Open

#8,373 建立於 2019年2月4日

在 GitHub 查看
 (6 留言) (0 反應) (0 負責人)C (9,908 star) (1,703 fork)batch import
Type: Featuregood first issue

描述

System information

Type Version/Name
Distribution Name all
Distribution Version all
Linux Kernel all
Architecture all
ZFS Version all
SPL Version all

Describe the problem you're observing

At the time I filed for this feature request I naively assumed that labelclear is the safe equivalent of mdadm --zero-superblock which only clears the products' own metadata

Instead currently labelclear performs destructive actions beyond just zfs metadata while the documentation fails to warn the user about these:

     zpool labelclear [-f] device
             Removes ZFS label information from the specified device.  The device must not be part of an active pool configuration.

             -f      Treat exported or foreign devices as inactive.

There is a stuck thread on a openzfs pull request originated from Illumos about wether labelclear should expose or not more internals, or if it should set a TXG 0 or corrupt the labels or zero wipe the labels.

from the enduser point of view, it is quite not relevant what is going on inside, the expectations are:

  • when I clear the device, limit the damage to the zfs labels, and don't touch any other bits, because I have also other data on different partitions. So if there are partitions created by zfs, DON'T DELETE THOSE PARTITIONS - that data belongs to the partition table and is not part of a vdev. Yes there could be leftofers such as gpt partition name zfs-random-numbers, leave that alone!

  • when I use that "cleared" block device again with zfs, do not complain that there was a zpool there. I knowingly cleared the device, so from my user point of view, there is no pool there, move on.

Describe how to reproduce the problem

read the manual use as described get non-zfs data destroyed

Include any warning/errors/backtraces from the system logs

貢獻者指南