zpool add allows creating a zpool with a mix of block sizes so that zpool remove then fails with "all top-level vdevs must have the same sector size" #15965
Labels
Type: Defect
Incorrect behavior (e.g. crash, hang)
System information
zfs-2.1.5-1ubuntu6~22.04.2 zfs-kmod-2.1.5-1ubuntu6~22.04.1
Describe the problem you're observing
zpool add
allows creating a mix of block sizes (ashift values) in a zpool, so that it becomes impossible to remove vdevs from it. This is quite a "gotcha"!Yes, it is a documented limitation of zpool remove, but it's still very user-surprising behavior. For one thing, even if the user does read the whole
man
page before usingzpool remove
(which, of course, everyone does) it's already too late to fix the problem by then! For another, the user may not even realize they're adding devices with different ashifts.Describe how to reproduce the problem
Gotcha! Imagine that the first 2 commands were run by a previous sysadmin and I had no idea about it. Now, I innocently add a disk - maybe not even knowing about the concept of "ashift" at all - and would never expect that I would be unable to remove that disk!
(On the real production system where I ran into this I have no idea whether anyone explicitly ran
zpool set ashift
or how it came to pass that the existing disks had a different ashift setting than the new disk, but it happened somehow. The above steps are just an easy way to repro it.)Even a person who knows about block sizes would probably not expect that the block size of one disk would prevent another disk from being removed. I'm sure there is some implementation reason for this, but to a user, it's completely unexpected behavior!
Obviously the best fix would be to allow
zpool remove
to work for a mix of block sizes, but if that's not possible thenzpool add
should not allow such a mix to be created so easily. I'm not sure if there is a use case for allowing it at all, but if so, it should require some extra "I understand I will be unable to remove disks after this" kind of flag from the user.The text was updated successfully, but these errors were encountered: