Deleting All Partitions From the Command Line

Solution 1:

Would this suffice?

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

Solution 2:

The wipefs program lets you easily delete the partition-table signature:

wipefs -a /dev/sda

From man wipefs

wipefs can erase filesystem, raid or partition-table signatures (magic strings) from the specified device to make the signatures invisible for libblkid.

wipefs does not erase the filesystem itself nor any other data from the device. When used without any options, wipefs lists all visible filesystems and the offsets of their basic signatures.

wipefs calls the BLKRRPART ioctl when it has erased a partition-table signature to inform the kernel about the change.