Installing a pseudo rescue for FreeBSD on a DediBox.
To create a rescue, we'll create a small partition and install a minimal installation of
FreeBSD. We could use
sysinstall but there is a bug with it when using multiple installations, so to create the partitions and slices we'll use the command line.
Here are the steps and the screenshots for this double installation after booting the box on
FreeBSD from the memory as described in
Dedibox FreeBSD.
- Create two partitions with fdisk :
# fdisk /dev/ad4
This disk has both DOS and BSD magic.
Give the 'b' command to go to BSD mode.
The number of cylinders for this disk is set to 19457.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/ad4: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/ad4s4 * 1 4 25000 a5 FreeBSD
Command (m for help): d
Selected partition 4
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19457, default 1): ENTER
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457): 250
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): a5
Changed system type of partition 1 to a5 (FreeBSD)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (251-19457, default 251): ENTER Using default value 251
Last cylinder or +size or +sizeM or +sizeK (251-19457, default 19457): 19457
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): a5
Changed system type of partition 2 to a5 (FreeBSD)
Command (m for help): a
Partition number (1-4): 1
Command (m for help): p
Disk /dev/ad4: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/ad4s1 * 1 250 2008093+ a5 FreeBSD
/dev/ad4s2 251 19457 154280227+ a5 FreeBSD
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
- Initialize the partitions and install the boot record:
# bsdlabel -wB ad4s1
# bsdlabel -wB ad4s2
- Using
bsdlabel -e ad4s2 Create the slices upon your needs, here is an example:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 6g 16 4.2BSD 0 0
b: 4g * swap
c: 308560455 0 unused 0 0 # "raw" part, don't edit
d: 20g * 4.2BSD
e: 6g * 4.2BSD
f: * * 4.2BSD
- Format the slices and mount them :
# newfs /dev/ad4s1a
# newfs /dev/ad4s2a
# newfs -U /dev/ad4s2d
# newfs -U /dev/ad4s2e
# newfs -U /dev/ad4s2f
# mkdir /rescue
# mkdir /dest
# mount /dev/ad4s1a /rescue
# mount /dev/ad4s2a /dest
# mkdir /dest/usr
# mkdir /dest/tmp
# mkdir /dest/var
# mount /dev/ad4s2d /dest/var
# mount /dev/ad4s2e /dest/tmp
# mount /dev/ad4s2f /dest/usr
- Launch
sysinstall and change Install Root to "/rescue" from the "Options" menu. Install normally in standard, express or custom mode, and choose the minimal installation. Then modify again the Install Root to "/dest" and install again upon your needs. Here are the screen shots of the custom mode :
- Finish the installation like in the Standard Installation, and take care, you need to copy the configuration files to both installation : /dest/etc and /rescue/etc.
- Don't forget to create the fstab files for both installations, you will have the rescue one like :
/dev/ad4s1a / ufs rw 1 1
And the /dest/etc/fstab :
/dev/ad4s2a / ufs rw 1 1
/dev/ad4s2b none swap sw 0 0
/dev/ad4s2d /var ufs rw 2 2
/dev/ad4s2e /tmp ufs rw 2 2
/dev/ad4s2f /usr ufs rw 2 2
- To boot on the rescue partition, choose mode secours from the web interface, connect via SSH and change the active partition using
fdisk /dev/sda and type a to choose the rescue one, then put back the server to the mode normal from the web interface.
Good luck
Comments