Need help switching between two FreeBSD boot drives

Matt Emmerton matt at gsicomp.on.ca
Thu Jan 5 20:30:35 PST 2006


> hi all-
>
> i've got one i've been tearing my hair out over here, and even after
> finding some information out there, i'm still totally lost. this may
> take a while to explain, so please bear with me.
>
> I've got 2 80GB SATA drives in my FreeBSD machine, which are mapped as
> /dev/ad4 and /dev/ad6. I've got 5_STABLE installed on 1 drive, and my
> plan is to get a working install of 6_STABLE on the other drive, so i
> can take my time to work out the kinks with the upgrade on the 2nd drive
> (it hasn't been straighforward) and be able to switch back to my working
> 5_STABLE machine as needed. That's the plan, anyway.
>
> So I followed the general instructions here:
>
>
http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/book.html#NEW-HUGE-DISK
>
> to clone drive 1 over to drive 2. very cool, no problems, i can pick
> either drive in the bootloader and boot up there. so all is well and
> good until i boot into drive 2 and start the upgrade process. I realize
> the /dev/ad4 and /dev/ad6 are not exactly fixed. It seems almost
> arbitrary which drive ends up mapped as /dev/ad6 and /dev/ad4, and this
> caused me to nearly munge all of the data on the working 5_STABLE
> install before i caught myself. If i boot into drive 1 at boot time,
> everything ends up being mounted at /dev/ad6. If i mount into drive 2 at
> boot time, the same thing happens. Mind you, i /did/ check /etc/fstab to
> ensure that all was well, but i ended up with a weird situation where,
> say, / would be /dev/ad4s1a and all of the other mountpoints were at
> /dev/ad6*. ugh. confusing!
>
> I found this page, which explains the problem /somewhat/:
>
>
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/install-steps.html
>
> but to be completely honest, the concept didn't stick. What i need help
> with, since these drives are exactly the same size and make, is how i
> can do the following:
>
> 1) determine the relationship between Drive 1/Drive 2 and ad4/ad6
> 2) determine exactly which physical drive i am working on at any given
> time, since the /dev node mappings seem to be malleable

Drive 0/Drive 1 always refer to the same devices, as FreeBSD ignores the
BIOS mappings (which may change, as outlined in the above docs).  These
drive numbers are assigned based on physical controller/device numbering and
addressing, and thus won't change unless you physically change device IDs or
move cables around.

However, once booted, FreeBSD, however, may assign different controller/disk
IDs to the physical devices, depending on what order the devices are
detected.  Usually this is static, but in some cases, it is not.

> 3) enable an environment where i can safely and surely boot into either
> drive and know for a fact that the right partitions are mounted ( all of
> the data on all of the partitions aside from / is mirrored, so it's
> practically impossible to tell which drive is which )

Compile custom kernels on both systems that contain "options ATA_STATIC_ID".
This will force the FreeBSD device names to always map to the same physical
controller/drive number.

> 4) (bonus points) My bootloader shows the following on boot:
>
>    F1: FreeBSD
>    F2: FreeBSD
>    F5: Drive 1
>
> a) I've only got 1 FreeBSD install on this drive, so what is F2? It just
> beeps at me when i try it

F2 represents a slice (in DOS terms, partition) on Drive 0 that is marked
bootable. The reason you get a beep is because there is no boot loader on
that slice.

> b) I assume that "F5: Drive 1" means that the drive i'm staring at the
> options for is Drive 2, adn that selecting F5 will toggle to Drive 1?

Drivers are numbered from 0.  So F1/F2 refer to bootable slices on Drive 0.


Regards,
--
Matt Emmerton



More information about the freebsd-questions mailing list