Wiping specific sec...
 
Notifications
Clear all

Wiping specific sectors with DD

9 Posts
3 Users
0 Reactions
712 Views
(@n00bcfe)
Eminent Member
Joined: 15 years ago
Posts: 26
Topic starter  

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
(@thall)
Trusted Member
Joined: 16 years ago
Posts: 53
 

man dd


   
ReplyQuote
(@n00bcfe)
Eminent Member
Joined: 15 years ago
Posts: 26
Topic starter  

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
(@thall)
Trusted Member
Joined: 16 years ago
Posts: 53
 

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
(@n00bcfe)
Eminent Member
Joined: 15 years ago
Posts: 26
Topic starter  

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
(@thall)
Trusted Member
Joined: 16 years ago
Posts: 53
 

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
(@n00bcfe)
Eminent Member
Joined: 15 years ago
Posts: 26
Topic starter  

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
Beetle
(@beetle)
Reputable Member
Joined: 17 years ago
Posts: 318
 

how about

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


   
ReplyQuote
(@n00bcfe)
Eminent Member
Joined: 15 years ago
Posts: 26
Topic starter  

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
Share: