Join Us!

Wiping specific sec...
 
Notifications
Clear all

Wiping specific sectors with DD  

  RSS
n00bcfe
(@n00bcfe)
New Member

hey guys-

I was wondering if you could help with me a dd command. How do I wipe a range of sectors on a device? Lets just for example purposes I wanted to wipe sectors 100-150.

I figured I would provide this if it provides some information that is needed.

Disk /dev/sda 160.0GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Quote
Posted : 12/02/2010 3:20 am
thall
(@thall)
Member

man dd

ReplyQuote
Posted : 12/02/2010 3:25 am
n00bcfe
(@n00bcfe)
New Member

man dd

Thanks Tom D . I checked the MAN page, but nothing jumped out to me to cover my question. MAN pages are sometimes not as descriptive as I would like. Can you point me to the proper flag? I think it may be possible with the skip=BLOCKS or seek=BLOCKS flags, but I am unsure of the syntax.

ReplyQuote
Posted : 12/02/2010 4:09 am
thall
(@thall)
Member

im not the best expert with dd but using;

skip=BLOCKS
Skip BLOCKS `ibs'-byte blocks in the input file before copying.

count=BLOCKS
Copy BLOCKS `ibs'-byte blocks from the input file, instead of
everything until the end of the file.

seems the best option for me, work out how many blocks your sectors take up skip the blocks before hand and copy only those blocks.

The rest is up to you as they say.

ReplyQuote
Posted : 12/02/2010 5:14 am
n00bcfe
(@n00bcfe)
New Member

im not the best expert with dd but using;

skip=BLOCKS
Skip BLOCKS `ibs'-byte blocks in the input file before copying.

count=BLOCKS
Copy BLOCKS `ibs'-byte blocks from the input file, instead of
everything until the end of the file.

seems the best option for me, work out how many blocks your sectors take up skip the blocks before hand and copy only those blocks.

The rest is up to you as they say.

Why would you skip blocks from your input file? Your input file would be zero. Wouldn't you use seek=BLOCKS (skip BLOCKS obs-sized blocks at start of output)?

ReplyQuote
Posted : 12/02/2010 5:39 am
thall
(@thall)
Member

well seek is related to the output file and skip is related to the input file, why would you skip blocks on the output file when your trying to pick from the input and send it to the output.

ReplyQuote
Posted : 12/02/2010 6:03 am
n00bcfe
(@n00bcfe)
New Member

well seek is related to the output file and skip is related to the input file, why would you skip blocks on the output file when your trying to pick from the input and send it to the output.

When you wipe a disk, your input file is zero. And your output file is where you want the zeros to be written. I would think you would want to skip blocks on the output file because you are not writing to the first block of the disk and only want to write the zeros to the range of sectors (my ex 100-150). So I would want to skip the first 99 sectors, start writing zeros from 100-150, then stop.

ReplyQuote
Posted : 12/02/2010 6:16 am
Beetle
(@beetle)
Active Member

how about

dd if=/dev/zero of=/dev/sda seek=100 count=50 conv=notrunc

ReplyQuote
Posted : 12/02/2010 7:44 am
n00bcfe
(@n00bcfe)
New Member

how about

dd if=/dev/zero of=/dev/sda seek=100 count=50 conv=notrunc

yeah, seek=100 count=50 is what I was thinking. I will have to run a test though to confirm

ReplyQuote
Posted : 12/02/2010 8:16 am
Share: