Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Sep 2010 02:29:59 -0700
From:      Jeremy Chadwick <freebsd@jdc.parodius.com>
To:        Michael Sperber <sperber@deinprogramm.de>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: How to predict drive number change for 7.3->8.1 upgrade?
Message-ID:  <20100916092959.GB16270@icarus.home.lan>
In-Reply-To: <y9l7himgit9.fsf@deinprogramm.de>
References:  <y9l7himgit9.fsf@deinprogramm.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Sep 16, 2010 at 11:05:06AM +0200, Michael Sperber wrote:
> I just upgraded my desktop system from 7.3 to 8.1, and the main hard
> drive, which was /dev/ad6 before is now /dev/ad10.  Consequently, the
> initial boot failed when trying to mount the root file system from ad6.
> 
> The desktop system is now fixed, but I also have a rented server with
> only a serial console, and I worry that the upgrade is going to leave me
> with a dead machine.  Is there any way to predict how the drive number
> changes?  (Why does it change at all?)  If so, what's the proper way to
> tell the system the initial root device *before* rebooting?

This has to do with ATA device naming schemes, and changes in the ATA
driver, in addition to capabilities of the chipset.  For example,
FreeBSD 7.x may have seen only 2 PATA or SATA ports on your system, but
with 8.x (and improved drivers) it may see 4, or possibly 2 of each (2
PATA, 2 SATA).  The device numbers shift/change as a result.  AFAIK,
there is no failsafe way to "predict" what the device numbers will be.

I've dealt with this "problem" many times, and this is how I do it:

Print out or copy/paste the contents of /etc/fstab prior to upgrade.

If you have serial console on your remote server, then you have little
to worry about -- you know what drive name/model/size is associated with
ad6 on 7.x.

When you upgrade, boot the 8.x kernel and into single-user mode.  While
the kernel boots, you'll see the device names in the kernel output, and
will then be prompted for the root filesystem.  Enter the correct ufs
reference string with the correct device number.

After that, just mount the /usr, /tmp, and /var filesystems by hand
using the correct device number.  Once you have that, you should be able
to edit /etc/fstab and change the device numbers (you might have to do
mount -o rw -u / to make it read-writeable).  Reboot the machine and go
into single-user, and you should find that the root filesystem is
mounted + mount -a should work fine + everything work going forward.

If you find that the device numbers are changing "randomly" after every
reboot, that's a separate problem and should be dealt with separately.

-- 
| Jeremy Chadwick                                   jdc@parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100916092959.GB16270>