Enabling Disk ID (/dev/diskid/*) on XigmaNAS

While the standard FreeBSD disk device enumeration found under /dev/sd* works just fine, I always found the serial number irreplaceable.

Not only it doesn’t depend on the ordering of SATA cables but it also ensures you don’t delete drive on the wrong machine. If you dd if=/dev/zero of=/dev/sda, you better be sure you’re on the correct machine. On the other hand, if you run dd if=/dev/zero of=/dev/diskid/DISK-SERIAL-123 on the wrong machine, you will just see an error telling you the device was not found. Much better.

But I don’t have /dev/diskid/, I hear you complain. XigmaNAS, as pretty much any FreeBSD system by default needs a slight modification to track disks this way.

To turn it on, go to System, Advanced, and loader.conf tab. There add kern.geom.label.disk_ident.enable=1 and reboot. Once system has started again, all your disks will have their entry in /dev/diskid/*.