Linux: Delete all partitions on a hard drive or SSD

Delete all partitions with one command.

After my experiment with hard drive mirroring in Windows, I wanted to use one of the SSDs for other purposes. However, it was only displayed as “Offline” in Windows. The attempt to reactivate it via the context menu did not work. The disk management simply stopped here.

Erase hard drive under Linux

Well, if Windows is on strike, then Linux it is. So I started my Linux box and connected the hard drive via USB. First I used “lsblk” to see what name the hard drive was registered under.

The deletion is then carried out with the following command:

sudo dd if=/dev/zero of=/dev/sdb bs=512 count=1 conv=notrunc

This deletes the first small part of the disc that contains the partitioning information.

All partitions were then deleted. To update the display, I had to disconnect and reconnect the hard drive once.

Leave a Reply

Your email address will not be published. Required fields are marked *