# drive dev names and "root mount error"



## cbrace (Aug 28, 2011)

Hi all,

Just now, I compiled a custom kernel with ALTQ. When I rebooted, I got the "root mount error".

After a bit of fiddling, I managed to bring the server up by typing:

```
mountroot> ufs:ad0s1a
```

It appears that after compiling the custom kernel, the harddisk device names have changed. The first drive which was hitherto ad4, is now ad0, and the second drive, which was ad6, is now ad1. IOW, root was previously /dev/ad4s1a but now has changed to /dev/ad0s1a.

Any thoughts on what happened here? Did I comment out something in the kernel config file which could have changed something?

More important, how do I fix it so that the system will boot properly from /dev/ad0s1a next time?

Thanks.


----------



## wblock@ (Aug 28, 2011)

```
options ATA_STATIC_ID
```
is the option that controls IDE/SATA drive numbering.

_Labels_ avoid the device number problem.  There are more than one kind of label.  FreeBSD Labeled Filesystems shows filesystem labels and glabel(8) labels.  Disk Setup On FreeBSD shows gpart(8) labels for GPT partitioning.

/dev/ufs/mylabel is the same no matter what hard drive connector is used.  Even if the device changes, like moving the drive from an internal connector to an external USB drive case (/dev/ad4 to /dev/da0), the label still works.


----------



## cbrace (Aug 28, 2011)

Extremely helpful, thanks. If I understand correctly, the problem ocurred when fstab was pointing to the wrong root partition. I will have a go at labels.


----------



## wblock@ (Aug 29, 2011)

If you installed a new kernel and toggled the ATA_STATIC_ID option, drive numbers would change, the entries in /etc/fstab would be wrong, and it that mountroot error shows up.  AHCI devices (/dev/ada0--if you're lucky enough to have motherboard support for them) don't even have a static numbering mode, so just adding another drive can do it.


----------

