openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.43k stars 1.73k forks source link

Warn before overwriting partition table; should require -f #10108

Open akorn opened 4 years ago

akorn commented 4 years ago

System information

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

Describe the problem you're observing

When creating a pool on two SSDs, I made a typo. Instead of zpool create ... /dev/sd[ae]7 I typed zpool create ... /dev/sd[ae7] and pressed ENTER.

zpool happily overwrote my partition tables. There wasn't any other data on the SSDs yet, but there might have been; as it was, I only noticed after zfs receive-ing a few hundred gigabytes into the new pool. I had to destroy the new pool, re-create the partitions, and re-receive the data, causing unnecessary wear on the SSDs. If my partitions had contained data, it would have been destroyed (although, looking at #4016, maybe zpool would have warned me then?).

I think it might be better to require -f in zpool create (as well as probably zpool attach and zpool add) if the requested operation would overwrite an existing partition table.

Describe how to reproduce the problem

Create some partitions on a disk (mine was gpt, but I don't suppose it matters), then create a zpool from the whole disk.

This is similar to #4016 but not identical, as I didn't actually have any filesystem in any of the destroyed partitions yet.

stale[bot] commented 3 years ago

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.

akorn commented 3 years ago

Bump, to keep the bot away.

stale[bot] commented 2 years ago

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.

akorn commented 2 years ago

Bump, to keep the bot away.