sysinstall(8) && bsdlabel a new disk

Ian Smith smithi at
Tue Nov 2 13:50:33 UTC 2010

In freebsd-questions Digest, Vol 335, Issue 3, Message: 2
On Tue, 2 Nov 2010 07:04:08 +0100 Matthias Apitz <guru at> wrote:
 > El día Monday, November 01, 2010 a las 10:03:58PM -0700, perryh at escribió:
 > > Devin Teske <dteske at> wrote:
 > > 
 > > > sysinstall probes hardware when it starts. Therefore, after making
 > > > changes (specifically after writing) to the disk in the FDISK
 > > > partition editor, you need to Ctrl-C and Abort-out and relaunch
 > > > sysinstall so that it probes the new disk devices (ad4s1, ad4s2,
 > > > etc.) before you can start adding BSD disklabels (ad4s1a, ad4s1b,
 > > > etc.) to the slice (aka partition).
 > > >
 > > > This has been an age-old problem (hmmm, perhaps get could some mad
 > > > karma for fixing it).
 > > 
 > > At least in 8.1, there is a sysinstall operation somewhere to
 > > re-probe devices, presumably to cover exactly this sort of
 > > situation.  Does it not work?

Options menu: Rescan Devices works to pick up devices like a USB disk or 
memstick that you may even have booted off but sysinstall then fails to 
find, as it does with some older kit and/or slow devices (here memsticks 
on USB1 ports).

 > My situation was in 9-CURRENT.

When running sysinstall(8) as init from a CD/DVD/memstick boot, you can 
do mostly what you like to the disk/s in terms of slicing - fdisk and 
like boot0cfg under the hood - and partitioning of slices - bsdlabel 
under the hood, or rather sysinstall's version of those utilities; it 
still uses libdisk(3) rather than libgeom(3), at 8-STABLE anyway.

When running sysinstall from a booted system (where you could exit after 
any committed steps and restart it, as mentioned above) you need to have 
previously set sysctl kern.geom.debugflags=16 (the 'foot-shooting' bit) 
if you want to be able to write to sector 0 (the boot sector including 
MBR) or to any non-boot slice - even unmounted - on the boot disk.

Sysinstall doesn't let you know when you've failed to modify the disk, 
sadly, hence mysterious problems such as the above.  It's fairly obvious 
when it fails to newfs some partitions you think you've nicely set up :)

Same goes for sade(8).  Neither manpage mentions kern.geom.debugflags, 
but boot0cfg(8) does, and points to the fuller description in geom(4).

I haven't checked up on new work on sysinstall on -CURRENT for a while, 
but suspect that you'll still have to set that flag to write to any disk 
that's in use.  Don't forget to set it back to 0 later!

cheers, Ian

More information about the freebsd-questions mailing list