SUMMARY: Format command: purging a disk

From: Michael Meystel (
Date: Tue Jul 11 1995 - 11:22:50 CDT


Thanks to all who responded. The original question is at the end of this
message. To summarize the question: how do I make sure I am purging a disk?

Ted Nolan ( said:

> You can read any block on the disk from Unix. You could use dd and od
> Ie to read and display block 5 of sd0:
> dd if=/dev/sd0c bs=1b skip=4 | od
> or you could write a short C program.
> Format will tell you what patterns it is using as it progresses. I think
> it uses a different pattern on each pass.

Rich Billingsley ( said:

> There is an application known as UNISHRED which correctly display all info
> about the drive you are purging:
> The company is Los Altos Technologies Inc.
> The phone # is 415-988-4848.
> Email address is

Donald McLachlan ( said:

> If you have patitioned you disk as Sun suggests the c / #2 partition is the
> backup partition which covers the entire disk ... Well this may not be
> entirely true for a SCSI drive ... it is just the part of the disk assigned
> to the "user". Other parts of the disk may have been used for sparing (and
> other management functions by the on-board drive controller).
> as is
> dd if=/dev/zero of=/dev/rsd{disk#}c
> will write zero's to all the parts of the disk that are currently assigned.
> If you are paranoid that some stuff will get left behind, ... you'd have to
> adjust the size of the drive upwards until format/newfs/fsck fails, and then
> reduced the size (1 block at a time) until you are using every available disk
> block. Then the dd command will write zeros to the entire drive.
> As for writing 1's to the drive, I'd write a program like this ...
> main()
> {
> while(1)
> putchar(-1);
> }
> After compiling it, I'd do
> a.out | dd of=/dev/rsd{disk#}c
> This will run until dd fails and then a.out will crash when the pipe breaks.

Larry Weissman ( said:

> You can easily check the non-defective part of the disk by reading
> and writing it yourself. Just open /dev/rsd?c as a file. You don't need
> a file system on the partition, but you do have to be root. You can also
> examine less than this using other partitions, but make sure nothing is
> mounted as a file system or in use as a swap space.

Thanks again.



Original Question follows.

> If I were to try to purge a disk, by writing 1's and 0's to it over and over
> again, I might conceivably use the format command.
> The format command's 'analyze' sub-menu contains some analysis options that
> write data to the disk, thereby erasing anything else that was there.
> However, this is very much tied in to defect lists and disk labels, and I'm
> not sure how.
> Questions:
> - format/analyze/{write,compare,purge}: do these procedures write 1's? 0's?
> random patterns?*
> * Actually, by setting analysis parameters with the 'setup' subcommand, one
> can specify whether or not to use random bit patterns. But if that setting
> is set to 'no', then what exactly does this procedure write to the disk?
> - do these procedures (for instance, the 'purge' command) write 1's, 0's, or
> random bit patterns, to the blocks marked as defective in the defect list,
> or are these blocks skipped over?
> - if the blocks in the defect list are skipped over during the purge, how
> would one go about writing 1's and 0's to the defective blocks? (This
> would be useful, for instance, in a situation where there was data on those
> blocks, and the blocks only became defective recently.)
> - And most importantly - is there a way to examine individual blocks on a
> disk to find out what is written on them? Some kind of show_block program
> that takes a block number as a parameter... I am pretty sure the format
> command doesn't do this, but I'm wondering if there is a utility that
> does do this or whether it can be done at the OBP level.

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:29 CDT