Linux – Deleting All Partitions from Command Line

fdiskgpartedlinuxpartitionUbuntu

How do you delete all partitions on a device from the command line on Linux (specifically Ubuntu)? I tried looking at fdisk, but it presents an interactive prompt. I'm looking for a single command, which I can give a device path (e.g. /dev/sda) and it'll delete the ext4, linux-swap, and whatever other partitions it finds. Essentially, this would be the same thing as if I were to open GParted, and manually select and delete all partitions. This seems fairly simple, but unfortunately, I haven't been able to find anything through Google.

Best Answer

Would this suffice?

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