Remote upgrade 4.8 to 6.0

Jonathan McKeown jonathan at hst.org.za
Thu Nov 30 00:21:43 PST 2006


OK, I said I was intending to try this. I've carried out the following 
procedure on a test box in my office: before I do it with a live server 400 
miles away, can anyone see any problems I've overlooked?

I have two boxes on the remote site - call them server and gateway. I have ssh 
access to both boxes and a null-modem serial cable linking their serial 
ports. server is running FreeBSD 4.8 on an 80GB hard drive (ad0), and has a 
second brand-new 80GB hard drive (ad2). gateway is effectively acting as a 
serial terminal server.

Copy the following files from a FreeBSD 6.0-RELEASE CD to ~root on server (I'm 
sure it works with 6.1 too, but 6.0 was what I had to hand for testing):

boot/boot1
boot/boot2
boot/loader
boot/mfsroot.gz
boot/device.hints
boot/kernel/kernel

and edit device.hints to add set  to the start of each line (that's 
``set<space>''). (I couldn't find another way to include the device hints 
when we get to that part of the loader sequence).

Use disklabel to upgrade the boot blocks on the FreeBSD slice:

disklabel -B -b /root/boot1 -s /root/boot2 ad0s1

This is so the bootloader will be able to read the UFS2 filesystem you are 
about to create. (Is it a problem to change the label on the slice rather 
than the root `a' partition within the slice - which you can't do with / 
mounted?)

Establish the serial console link from gateway to server and

echo ``/boot/loader -h'' >/boot.config

on server.

Reboot server, get past the initial bootblock prompt, and interrupt kernel 
booting to get to a loader prompt.

Enter the following:

unload
load /root/kernel
include /root/device.hints
load -t mfs_root /root/mfsroot
set vfs.root.mountfrom=ufs:/dev/md0c
boot

You are now running FreeBSD 6.0 sysinstall from a memory disk on a serial 
console. Carry out the installation on ad2 (in theory, you could actually do 
this on ad0 if you wanted to blow away your original installation and didn't 
have a spare drive installed), remembering to visit the configuration menu 
and edit /etc/ttys to enable serial console login. Because the install was 
done over a serial link, the installed system should be configured for serial 
console.

Reboot. At the bootblock prompt, enter
1:ad(0,a)

to boot from the new drive. You should now be running FreeBSD6 multiuser, with 
a serial console for login, off ad2, and you can configure it, copy data from 
the old installation on ad0, etc. (My intention is to set up ad2 as a gmirror 
drive at this point - there is the extremely unlikely, but possible, risk of 
loss of data from adding the metadata to the last sector. I want to take the 
risk early before transferring too much data!). If you reboot the box it will 
drop to a bootblock prompt from the 4.8 installation: if you want to change 
that, put

1:ad(0,a) -h

in /boot.config. The BIOS will still start the boot process from ad0, the 
lowest-numbered drive, but the bootblock will switch over to the other drive.

Once that's done, and the 4.8 installation is no longer needed, ad0 can be 
added to the mirror.

Comments, anyone?

Jonathan


More information about the freebsd-questions mailing list