@ilovezfs said:
>Suppose the user, seeing c2t1d0 in the zpool status output, DOES do "zpool 
>labelclear /dev/rdsk/c2t1d0." The user is likely to conclude that the command 
>was successful because supplying the full device mistakenly because the 
>command will have the side effect of destroying the GPT. The GPT was there 
>before the labelclear command. Partitions were visible, etc. After the 
>command, the gpt is gone and the partitions are no longer listed. So the 
>command worked, right? After all, it did do something.

I think @wca says this is not the case:
> if there is no label then the command treats it as a success

So after the command, gpt would not be gone, instead the "zool labelclear" was 
a no-op.  (unless I misunderstood).  We definitely should not be zeroing out 
stuff we do not understand (at least by default, maybe there could be some 
super-force-flag to enable this).

I think that if "zpool labelclear" does not find a zpool label on the specified 
device, that should be an error (rather than a silent no-op success).  It 
should print a message and exit nonzero.  This applies regardless of whether or 
not it translates the input (c0t0d0 -> c0t0d0s0).  But if we didn't want to 
translate the input, we could make this easier on the user by writing a good 
error message.  e.g.:

```
$ zpool labelclear c0t0d0
No such device /home/mahrens/c0t0d0.  Did you mean /dev/dsk/c0t0d0s0?
$ zpool labelclear /dev/dsk/c0t0d0
There is no zpool label on /dev/dsk/c0t0d0 (GPT label found).  Did you mean 
/dev/dsk/c0t0d0s0?
```

I think it would also be reasonable for "zpool labelclear" to try applying some 
platform-dependent default guesses about what the user meant.   (Avoids "Did 
you mean X" "You know I meant X, why didn't you just do it".  mdb on compressed 
dumps always annoys me.)  As long as we only zero actual zpool labels (that 
belong to destroyed pools, unless -f is specified), I think this is pretty safe.

---
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/32#issuecomment-152751652
_______________________________________________
developer mailing list
[email protected]
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to