CentOS erase all Linux partitions

I need to erase all partitions stored on second hard disk. Let us name it /dev/sdb. That is actual name of my second disk and it comes with two Linux partitions

  • /dev/sdb1
  • /dev/sdb2

How do you delete and erase all Linux partitions from /dev/sdb and make it empty like a brand new disk?

I use gparted in a GUI screen.

Try dd command (warning all data and partitions would be deleted and can not be recovered):

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

See


Another option is
shred -n 5 -vz /dev/sdb

See


HTH
1 Like

A hammer applied to a disk will remove all partitions etc

That is not useful answer. How does this help OP to use the disk again?

The only certain way to permanently remove all partitions/data from a disk is to physically destroy the disk. However, since the OP is discarding their system it appears that there is no particular desire to reuse the disk.

If you want to reuse the disk, just repartition as necessary.

@axisofevil I don’t want to physically destroy my hard disk. I never typed I want to. I want to remove all old data and make it like new as I did using dd command. That is the correct answer for me at least.

1 Like

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki