Tripped over an issue recycling a disk using LVM
WARNING: dos signature detected on /dev/disk/by-id/ata-TOSHIBA_MK6459GSX_X9QCF7BGS at offset 510. Wipe it? [y/n]: [n] Aborted wiping of dos. 1 existing signature left on the device.
This came from (failed) volume group creation within a puppet run.
There’s a tool called wipefs which fixes this. I’d like to see how this handles disks with bits of LVM still on them.
It’s in the minimal raspberry pi Centos 7 build as well, which was a nice bonus.
The linked page above specifies then passing ‘–all’ and ‘–force’ but every time I see the force being used (use the Force, Luke) I want to understand why, and ideally avoid it.
# wipefs /dev/disk/by-id/ata-TOSHIBA_MK6459GSX_X9QCF7BGS offset type ---------------------------------------------------------------- 0x1fe dos [partition table] # wipefs --help Usage: wipefs [options] <device> Options: -a, --all wipe all magic strings (BE CAREFUL!) -f, --force force erasure -h, --help show this help text -n, --no-act do everything except the actual write() call -o, --offset <num> offset to erase, in bytes -p, --parsable print out in parsable instead of printable format -q, --quiet suppress output messages -t, --types <list> limit the set of filesystem, RAIDs or partition tables -V, --version output version information and exit # wipefs --offset 0x1fe /dev/disk/by-id/ata-TOSHIBA_MK6459GSX_X9QCF7BGS /dev/disk/by-id/ata-TOSHIBA_MK6459GSX_X9QCF7BGS: 2 bytes were erased at offset 0x000001fe (dos): 55 aa /dev/disk/by-id/ata-TOSHIBA_MK6459GSX_X9QCF7BGS: calling ioclt to re-read partition table: Success
There, no need to go to the dark side.