ADAM'S WEB PRESENCE

2 February 2008

UUIDs in the fstab

Filed under: Nerd Notes — adam @ 8:54 am

I have a machine with about 8 SATA hard drives in it some of which are connected to a PCI controller card and some are on the motherboard. I have an issue with Debian that it keeps swapping the device nodes around on reboot. Sometimes the first drive will be /dev/sda, other times it will be /dev/sde. Somehow the system manages to boot up OK but when it comes time to mount the drives, all hell breaks loose!

My solution is to mount the drives by their UUID rather than by their device node. It took me quite a bit of Googling to find an example of how to do this so I thought I’d write it here so I will know for next time.

Normally, I’d put an entry in /etc/fstab like this to mount a drive:

/dev/sdb1  /var/www  ext3  defaults  0  2

But now I change it like so:

UUID=bd412298-d540-4e4e-8f31-33ff45644bc4  /var/www  ext3  defaults  0  2

You’ll notice it is exactly the same except I have used the UUID instead of /dev/sdb1.

But wait! I hear you ask, how do you find out what your drive’s UUID is ?

Well, I have the answer for that too:

ls -l /dev/disk/by-uuid/

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment


Powered by WordPress