Welcome! Enter your question below. Please use words like "Who, What, Where, When, Why, How, etc..." in your question. Nothing to ask? Click here for a random, un-answered question.

How can a hard drive be wiped clean in Linux?

1,021,887questions on
Add New Page
Add New Page Talk0

If you want to wipe your hard to clean up partition errors, bad installations, or for privacy, you can use the dd Unix command.

To wipe the entire disk and overwrite all partitions, master boot records, and data, you can fill the disk with all zeros using dd if=/dev/zero of=/dev/sda bs=1M

If you are wiping your hard drive for security, you should populate it with random data rather than zeros using dd if=/dev/urandom of=/dev/sda bs=1M

If you messed up your master boot record (MBR) you can wipe it using dd if=/dev/zero of=/dev/hda bs=446 count=1

You can wipe a partition using the same method than for the whole disk. Just replace the device identifier. If /dev/sda is the whole disk, then (on Linux, because the naming scheme vary from one Unix to another) /dev/sda3 is the third partition on the disk. Filling the second partition on the /dev/sda disk with all zeros :dd if=/dev/zero of=/dev/sda2 bs=1M. Filling the third partition with random data :dd if=/dev/urandom of=/dev/sda3 bs=1M

To wipe specific files, try the command "wipe filename".

This question was asked on The HowTo Wiki.

Also on Fandom

Random Wiki