Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

To clear a large hard drive I was using dd if=/dev/zero of=/dev/sda. Only later I realized from reading more sources that the default block size is 512, and if I want the process to go quicker I should increase the block size to at least 4M.

My question is what happens if I cancel before it finishes (ctrl + c or quitting terminal would cancel it hopefully?). Am I able to redo the command and set a higher bs? Or would the system basically be corrupted at this point and I wouldn't even be able to log back in? If I can still redo it at this point, what would be the highest bs value I can use for a 1TB drive (software raid 1 if it matters)?

share|improve this question
2  
Why not try it? You're wiping the system anyway, why does it matter if it gets corrupted? You should be doing this from a Live CD/USB image though. –  gparent Jul 21 '13 at 1:05
    
This happened when I run dd on a live OS. –  Hennes Jul 21 '13 at 13:15

2 Answers 2

Corruption is a funny thing when you're overwriting a hard drive. You should assume that your disk is corrupted after the first few blocks have gone through (meaning <1 second). Your end goal here is to completely rewrite every byte on the disk with 0x00, right? Whether a specific byte is written once, or twice, or 30 times, at the end of the day it's still 0x00 and your data is effectively unrecoverable.

share|improve this answer

If your OS is not on /dev/sda then of course you can cancel it.

If your OS is on the dfisk you are wiping then it depends. E.g.

  • How long was the dd command running?
  • Which OS/distribution did you use? Are things cached and seemingly available even though the underlying information on the disk is already destroyed?

And finally, why try to run this from inside the OS? Normally I would either boot from another disk (e.g. a liveCD or a liveOS on a pendrive), or I would send the disk the command to erase itself without any OS intervention. This is done with the secure erase command. You can issue this command with the hdparm tool.

First use hdparm -I /dev/sda to check that the drive is not frozen.

Then set a password:
hdparm --user-master u --security-set-pass Mypasswordhere /dev/sda

Finally issue the secure erase command:
hdparm --user-master u --security-erase Mypasswordhere /dev/sda

If you need to do this to many computers, try Darik's Boot And Nuke disk.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.