Using ufsid with FreeBSD
This feature has been present since 7.2, but it's less verbose in 8.0 (we'll get to that soon). Basically these labels decouple the devices from the actual device node.
What this means is that you can move the devices around (like on a different hardware port, different system, even different driver/controller), and all your mountpoints will work fine.
You could also use plain UFS labels (which serve the same purpose), with the only difference being that plain UFS labels exist if someone created them, and you also need to pay attention to duplicates. On the other hand ufsids are always present without any additional action, and they are unique.
Before 8.0, you would see the ufsid labels in dmesg by default. Now you have to add this to /boot/loader.conf and reboot:
kern.geom.label.debug=1
You will see something like this in dmesg:
GEOM_LABEL[1]: UFS2 file system detected on ad2s1a.
GEOM_LABEL[1]: Label for provider ad8s1a is ufsid/5b30a2f125a1d114.
In fstab you can now have instead of your usual entries:
# Device Mountpoint
/dev/ad2s1a /
this:
# Device Mountpoint
/dev/ufsid/5b30a2f125a1d114 /
Because swap is not an actual filesystem, you need to make a plain UFS label for it:
#glabel label swap /dev/ad2s1b
Then add it to /etc/fstab as well:
# Device Mountpoint
/dev/label/swap none
That's it, you can now reboot an enjoy your portable disks.
Important: ufsids will not work with geli. The reason is that the ufsid for your encrypted provider will only be available after geli has attached, and for that you obviously can't use that very same ufsid because it doesn't exist yet. If anyone has a solution for this let me know.