1

The idea is to wipe all partitions with a terminal command. I found these:

 dd if=/dev/zero of=/dev/sda bs=1M count=8 && sync

and

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

The sources are here and here.

Edit after comments:

What about this:

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

from here


I have this problem. The mbr is already lost I think. I just want a virgin hdd on which to create new partitions and to install new systems.

3 Answers3

2

The value provided for block size options is base 10. The default value for both input and output block sizes is 512 bytes. A larger block size results in more memory being used by dd, and is usually faster.

count=BLOCKS
      Copy BLOCKS `ibs'-byte blocks from the input file, instead of
      everything until the end of the file.
notrunc'  Do not truncate the output file.
sync'     Pad every input block to size of `ibs' with trailing zero bytes.

dd Manpage

Mitch
  • 109,787
1

The first and second commands will overwrite the MBR of your device but they are different concerning GPT.

The first command writes 8MB of zeros and flushes the file system buffers. In case there is a GPT parts of the primary GPT are overwritten.

The second command writes 512B of zeros. In case there is a GPT the primary table will still be intact. (The conv=notrunc option does not make any difference because all data on the disk are lost anyways.)

Any secondary GPT at the end of the disc is left untouched by these commands.

The third command starts writing at the partition XX and does not remove the partition table.

This should erase your MBR or GPT.

sgdisk -Z /dev/sdX

After that you should be able to create a new MBR or GTP.

0

Booted in a live usb session and did

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

But that didn't seem o work as I wanted, as the light for the processor working was mostly off (or is it the hdd light?), while the cooler was very loud.

Then I read that the urandom command is very slow as it is really trying to produce really random numbers. I was not interested in wiping all the data for security, but just in clearing off all partitions (something was wrong with them), so I stopped the procedure and did:

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

With this the cooler calmed down while that "working light" was there permanently.

And to see the progress of this, I opened a separate terminal window and did

watch -n5 'sudo kill -USR1 `pgrep ^dd`'

which every 5 secs reports the progress in the initial terminal window (source)

245423407104 bytes (245 GB) copied, 3430.82 s, 71.5 MB/s
234354+0 records in
234354+0 records out
245737979904 bytes (246 GB) copied, 3435.84 s, 71.5 MB/s
234655+0 records in
234655+0 records out
246053601280 bytes (246 GB) copied, 3440.88 s, 71.5 MB/s
234956+0 records in
234956+0 records out
246369222656 bytes (246 GB) copied, 3445.91 s, 71.5 MB/s

... it took 2 hours and thirty minutes for a 500GB HDD on a 4-year average laptop with 4GB ram.