Subject: Re: [Q] disklabel erasure
To: None <sam@Progressive-Systems.Com>
From: Frederick Bruckman <fb@enteract.com>
List: netbsd-users
Date: 02/14/2000 13:57:24
On Mon, 14 Feb 2000 sam@Progressive-Systems.Com wrote:

> What is the exact command to erase the disklabel on a disk?
> If you only want to erase the disklabel, but no other data, what would
> you use?
> 
> I used "dd if=/dev/zero of=/dev/rsd0d count=20" but I suspect count
> was larger than was needed.  It was a new disk, so there was no data
> on it.

On i386, the disklabel goes near the beginning of the NetBSD
partition, wherever that happens to be...

fredb@fiona-> dd if=/dev/rwd0a skip=1 count=1 2>/dev/null | strings
mydisk

If you really must surgically excise a single block with "dd", I
believe "conv=notrunc" will ensure that only one block is written.
Without it, it's anyone's guess how many subsequent blocks get
zero'ed.

> It might be useful to put the command in the disklabel manual page or
> better yet, augment disklabel with another option that removes the
> disklabel from the disk.  I know this is inherently risky, but there
> are times when it's better to simply erase the disklabel and start
> over.

Why? It's easy enough to edit the disklabel on a running system
without losing the partitions you want to keep. If the disk is empty,
on the other hand, why not just zero out the whole disk? I've done
that to "new" old disks before using them, but I've never had to
remove just the disklabel.