HTGWA: How to completely erase a hard drive in Linux
This is a simple guide, part of a series I'll call 'How-To Guide Without Ads'. In it, I'll show you how I completely initialize a hard drive so I can re-use it somewhere else (like Ceph) that doesn't like drives with partition information!
First, a warning: this blog post does not show how to zero a hard drive, or secure erase. That's a slightly different process.
But as someone with way too many storage devices (from testing, mostly), I find myself in the position of trying to use a spare drive in some place where it expects a brand new drive, but winds up failing because the drive had a partition, or had valid boot files from an SBC or something.
I wanted to document the easiest way in Linux to completely reset a hard drive—at least from Linux's perspective.
The impetus was when I was trying to get some hard drives added to a Ceph OSD, and the process that tried adding them ran into an error stating RuntimeError: Device /dev/sda has partitions.