Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the dd command in Linux for securely wiping sector 62 of a hard drive. This sector lies in track zero, begins at offset 31744 and is 512 bytes long.

I'd like to know how to wipe it over 1000 times with ultra random data and then wipe over it say 100 times with zeros.

My computer has only one hard drive and I'll be doing this from an Ubuntu live CD using the terminal.

share|improve this question
2  
Backup anything you don't want to wipe out, then nuke the HDD from the orbit. It's the only way to be sure. (Sorry, could not resist.) –  delnan Jun 26 '11 at 9:42
1  
Wow, that's 512 bytes you really want to make go away. I wonder what they are. –  Lukasa Jun 26 '11 at 9:58
    
Whatever they are, they have three separate single-question accounts asking this same question one, two, three times within the past couple of days alone. –  JdeBP Jun 26 '11 at 13:56
    
This wasn't posted on superuser but on stackoverflow and migrated here... I am not a single question account im registered with stack exchange. –  Daniel Gratz Jun 26 '11 at 16:45
add comment

migrated from stackoverflow.com Jun 26 '11 at 9:47

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 1 down vote accepted

run the following command however times you want: warning: this has its share of risk of damaging your valuable files & data. don't run unless you understand it...

$ sudo su [enter]
# dd if=/dev/random of=/dev/sda bs=512 count=1 seek=62 [enter]
# dd if=/dev/zero of=/dev/sda bs=512 count=1 seek=62 [enter]

note that

repeat [times] [command]

would repeat the command [command] for [times].

EDIT1:
substitute urandom with random if you want more randomness
substitute random with urandom if you want more speed

EDIT2:
add the zeroing back

share|improve this answer
    
Thanks. So repeat 1000 dd if=/dev/random of=/dev/sda bs=512 count=1 seek=62 is correct? I would have thought i'd have to specify the offset not just 62. But if it understand that it is 62nd sector then i guess it is ok, but it would be a disaster if sector 63 got deleted. Of course this is relative to the physical hdd not logical. –  Daniel Gratz Jun 26 '11 at 10:08
    
you just install grub again if you have such problem (or, plug in the windows installer disc and repair the bootloader) –  bubu Jun 26 '11 at 10:09
    
It worked, however the 'repeat' command was 'not found'. So basically i don't know how to loop it a desired number of times... –  Daniel Gratz Jun 26 '11 at 17:11
    
for I in {1..100}; do dd if=/dev/zero of=/dev/sda bs=512 count=1 seek=62; done –  Daniel Gratz Jun 26 '11 at 18:28
    
IIRC repeat is a c shell command –  bubu Jun 27 '11 at 7:01
add comment

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.