[Macpartners] Zeroing sectors of just one volume (on a partitioned drive)
David M Rosenberg
rosenberg at MIT.EDU
Mon Jul 4 00:08:40 EDT 2005
I want to thank Timothy Boyden <trboyden at mit.edu> for his suggestion
and report on my success following it and to thank Kerem B Limon
<k_limon at MIT.EDU> for his helpful comments.
I wanted to protect against someone who was browsing through sectors
on the disk. That takes long enough - I didn't feel that I wanted to
take the additional time to protect against someone who might use
special hardware to recover overwritten data.
Disk Utility said the disk was "disk2s12" and that it contained
44571025408 bytes.
Since 44571025408 / 512 = 87052784 512-byte blocks, I could use the
command: dd if=/dev/zero of=/dev/disk2s12 count=87052784
However, the disk is advertized as having an eight-megabyte buffer and
an experiment showed that the transfers went almost four times as
quickly with eight-megabyte blocks than they did with 512-byte blocks.
(I saw 1.94 to 2.15 megabytes/sec with 512-byte blocks and 7.32 to
7.40 megabytes/sec with eight-megabyte blocks.)
8 megabytes / 512 = 16384 512-byte blocks
87052784 / 16384 = 5313 8-megabyte blocks + 4592 512-byte blocks
So I used the following two commands
dd if=/dev/zero of=/dev/disk2s12 bs=8m count=5313
dd if=/dev/zero of=/dev/disk2s12 seek=5313x16k count=4592
The process seemed to work exactly as expected.
With a Firewire (400) attached disk drive, even using the
eight-megabyte block size, it still took over 100 minutes to zero a
40-giabyte partition.
In subsequent experiments I fount that I seemed to get the highest
transfer speed (approximately 7.45 megabytes/sec) with a block size of
32768 bytes. This number may relate to the geometry of this particular
drive (or even, this particular part of this particular drive).
Anyway, if I need to do this in the future, my computation would be :
32768 / 512 = 64 512-byte blocks
87052784 / 64 = 1360199 32768-byte blocks + 48 512-byte blocks
So I would use the two commands:
dd if=/dev/zero of=/dev/disk2s12 bs=32k count=1360199
dd if=/dev/zero of=/dev/disk2s12 seek=1360199x64 count=48
/David M Rosenberg <rosenberg at mit.edu> 1-617-253-8054
MIT / IS&T / Admin Computing / Technical Services
Quoting Timothy Boyden <trboyden at MIT.EDU>:
> According to this posting, apparently you can do the same thing using
> the UNIX 'dd' command:
>
> ***********
> bdl
> 08-16-2002, 05:03 PM
> Best way I've found to wipe a drive, data, partition table and all is to
> just use the 'dd' command under linux (or possibly BSD, I can't confirm
> atm). You just issue the command
>
>
> $ dd if=/dev/zero of=/dev/hda bs=1M count=38172
>
>
> Where the device is your drive device and the count value is the size of
> your hdd.
> Some SCSI controllers also have this function built in, when you boot up
> and enter the SCSI utility screen you'll see it.
>
> ************
>
> Instead of the output file being the drive, you could point it to your
> partition. 'dd' is a powerful command and if your not sure how to use it
> properly I would reccomend not trying it. There is lots of information
> online about it if you want to give it a try though.
>
>
> Tim Boyden
> MIT Department of Facilities
> IT Group
>
> David M Rosenberg wrote:
>
>> With Apple's Disk Utility (version 10.4.4 in MacOS X 10.3.9), when
>> you go to erase an entire drive there is an "Options..." button that
>> has checkboxes for the following two options:
>>
>> Zero all data (writes zeros to all sectors of disk)
>>
>> 8 Way Random Write Format
>> (writes random data over entire disk eight times)
>>
>> However, if I go to erase one volume on a disk drive, the "Options..."
>> button is disabled and I don't see a way of zeroing all the sectors of
>> just one volume.
>>
>> Does anyone know how to zero all the sectors of one volume without
>> effecting other volumes on the same drive with either Apple's Disk
>> Utility or some other free utility?
More information about the Macpartners
mailing list