Scripted FreeBSD installation / Boot problem

Hi list,

I'm working on a project called veewee that tries to automate the installation of many operating systems for Virtualbox. Instead of the traditional PXE boot setups, I go for simulating typing and getting files over http.

For FreeBSD installation, I boot a mfsBSD ISO, ssh into the machine and run a script to configure the virtual machine.

I got partitioning, sysinstall and so on working. But when I reboot it complains about a bad partition. It turns out that my SATA disks are seen as ad4 instead of the traditional ad0. When I change the boot prompt, I can happily boot the machine.

It would be nice if someone can have a look at my sequence of commands and tell me the part I'm missing to make ad4 the default for finding the kernel and stuff to boot.

The install script can be found at my github account:
https://github.com/jedi4ever/veewee/blob/master/templates/freebsd-8.2-experimental/postinstall.sh
 
I believe the device numbering (ad0, ad1, ad4..etc) is determined by how the kernel probes the devices. The device ad4 usually refers to the first (master) device on the third IDE controller found on the system.

At any rate, I'd skip looking for specific devices and instead use labels on the filesystem. Then in fstab you can just reference the device by its label, so if it moves around its not a problem. For details, see the handbook entry on labeling filesystems.
 
With the standard ata(4) driver, ad0 to ad3 are reserved for the Master and Slave drives on the Primary and Secondary IDE channels usually found on the motherboard, so disks on additional PATA controllers, or SATA controllers in legacy IDE mode will start at ad4.

SATA disk numbering will increase in two's, ad4, ad6, ad8 etc, as in IDE mode they just appear as master disks on a standard IDE channel with no slave present.

If your onboard SATA interface is AHCI compliant and configured as such in the BIOS, you can use the ahci(4) driver to make your SATA disks appear as ada0, ada1, ada2 etc

In answer to the original question, you could try adding a line like the following to /boot/loader.conf:

Code:
vfs.root.mountfrom="ufs:/dev/ad4s1a"
 
Back
Top