User Tools

Site Tools


Sidebar

js#vista.png msort nsort

filesystems:wipe_drive

Howto Wipe your drives or partitions

From time to time you will need to wipe a drive or partion and here are the best ways to do it.

The quick and easy way

The fastest way is to simply write a bunch of zeros to the drive so:

dd if=/dev/zero of=/dev/sda bs=1M

The secure way

The more secure option is to write a bunch of random data to the drive so:

dd if=/dev/urandom of=/dev/sda bs=1M

Be advised that the second option can take HOURS to finish.

Clear the Boot Sector

Due to the way dd works you can very easily clear your MBR using the following:

dd if=/dev/zero of=/dev/sda bs=446 count=1

the “bs” option tells dd how many bytes to write per cycle and the “count” of “1” tells dd to run a single pass (cycle).

Clear a partition

Clearing a partition is just like clearing a complete drive except you tell dd which partition should be cleared instead of the complete drive:

dd if=/dev/zero of=/dev/sda3 bs=1M

or

dd if=/dev/urandom of=/dev/sda3 bs=1M

As you can see, instead of telling dd to write to “/dev/sda” we change it to “/dev/sda3”.

Enjoy

filesystems/wipe_drive.txt · Last modified: 2020/02/24 11:16 (external edit)