Installer un pseudo rescue pour FreeBSD sur une DediBox.
Pour créer un rescue, on va créer une petite partition et installer une instaltion minimal du
FreeBSD. Pour créer les deux partitions, on pourrait utiliser
sysinstall mais il a un bug concernant la double installation, parfois il gère mal les multi-partitions, pour cette raison, j'ai créé les partitions/slices en ligne de commande :
Voici les étapes et les captures d'écrans avec cette double installation après le démarrage sur
FreeBSD en mémoire comme expliqué dans
Dedibox FreeBSD.
- Créer deux partitions avec 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): ENTREE
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): ENTREE
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.
- Initialiser les partitions et installer le boot record:
# bsdlabel -wB ad4s1
# bsdlabel -wB ad4s2
- Avec
bsdlabel -e ad4s2 créer les slices selon vos besoins, voici un exemple :
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
- Formatter les slices et les monter:
# 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
- Lancer
sysinstall et dans le menu "Options" changer Install Root en "/rescue", installer normallement en mode standard, express ou custom, et choisir une installation minimum. Puis modifier encore une fois Install Root en "/dest" et effectuer la deuxième installation selon vos besoins. Voici les captures du mode custom :
- Finir l'installation comme dans Installation Standard, en faisant attention de copier les fichiers de configuration deux fois, une dans /dest/etc et l'autre dans /rescue/etc.
- N'oubliez pas de créer les fichiers /etc/fstab pour les deux installations, vous aurez /rescue/etc/fstab comme :
/dev/ad4s1a / ufs rw 1 1
et /dest/etc/fstab comme :
/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
- Pour choisir de démarrer votre serveur sur le mode rescue, choisissez le mode secours sur l'interface web, connectez-vous en SSH puis changer la partition active en utilisant
fdisk /dev/sda et tapez a pour choisir la partition active, puis passer le serveur en mode normal.
Bon courage.
Commentaires