FreeBSD disk labeling

I noticed that I’m a big user of my blog, simply because I forget things. So it is becoming “Note to self” blog :)

Recently I came to a stupid problem when the first controller in the server – the boot one – came numbered last on FreeBSD.

So the boot disk came to a /dev/da24.

The problem was that this server is changing the number of disk, so the boot device would always change, leaving a non bootable OS because of the /etc/fstab mount file.

So the tool for the action is Disk labeling: (old stuff)
FreeBSD disk labeling

Simply, boot into the single user mode and do a:
glabel label root /dev/da24a (root device or whatever is with you)
glabel label swap /dev/da24b (swap device number)

and change /etc/fstab devices to boot from /dev/label/root and /dev/label/swap for swap.

for example:
# cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/label/root / ufs rw 1 1
/dev/label/swap none swap sw 0 0