Synchronise the disklayout
gpart backup ada0 > /tmp/ada0.gpt
gpart restore -F /dev/ada1 < /tmp/ada0.gpt
Check that everything went as expected.
gpart show
Add the geom kernel module as loaded on startup
echo 'geom_mirror_load="YES"' >> /boot/loader.conf
Add bootcode to the second disk
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 /dev/ada1
Reboot into single-user mode. Then load the geom kernel module
gmirror load
Set up the mirror
gmirror label -vb round-robin p1 /dev/ada0p1
gmirror label -vb round-robin p2 /dev/ada0p2
gmirror label -vb round-robin p3 /dev/ada0p3
Add the mirrored disk
gmirror insert p1 /dev/ada1p1
gmirror insert p2 /dev/ada1p2
gmirror insert p3 /dev/ada1p3
Wait for the disks to synchronise
gmirror status
Modify the fstab on the new device
mount /dev/mirror/p2 /mnt
cp /mnt/etc/fstab /mnt/etc/fstab.old
ee /mnt/etc/fstab
Reboot into multi-user mode
To backout from this, using the second disk as main disk do the following with the assumption that first disk is disconnected, thus there’s only one physical disk left now named ada0:
Boot into single-user mode. Then load the geom kernel module
gmirror load
Deactivate the now degraded mirror
gmirror deactivate p1 /dev/ada0p1
gmirror deactivate p2 /dev/ada0p2
gmirror deactivate p3 /dev/ada0p3
Clear metadata from the disks
gmirror clear /dev/ada0p1
gmirror clear /dev/ada0p2
gmirror clear /dev/ada0p3
fsck the the disk in order to be able to mount it
fsck /dev/ada0
Edit the fstab. ee can be run without having to mount /usr
mount /dev/ada0p2 /mnt
cp /mnt/etc/fstab /mnt/etc/fstab.mirrored
ee /mnt/etc/fstab
Reboot into multi-user mode
Recent Comments