Subject: Re: Automatically disklabel entire disk
To: None <tech-embed@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-embed
Date: 06/27/2005 23:45:22
>> Is it possible to autmatically, non.interactively disklabel entire
>> blank disk not knowing what size it has?

Strictly, no, but it is possible to noninteractively find that size and
use it to disklabel, which amounts to about the same thing.

> You can use something like "disklabel disk0 >file", then read stuff
> for partitioning out of the file, then put the disklabel back with
> "disklabel disk0 file" or so.

Yes.  I use "disklabel xxx | disklabel -R -r xxx /dev/stdin" fairly
regularly to install an initial label on disks for which labeling
involves magic I don't really understand (mostly i386).

Of course, you can stick another program, or a sed script, or some
such, into that pipe to do things to the disklabel (like bust up the c
partition - or perhaps d on i386 - into something smaller) in between
reading the original synthesized disklabel and writing it back as a
real disklabel.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B