Replace /dev/xxx With UUID


My recent (re)build of my old Intel Pentium 4 system to run in my Linux system has a slight problem with jumping drive points e.g one minute my /home drive on /dev/sdb1 suddent goes to /dev/sda1 after a reboot etc, etc. A way around it is to use UUID in place of the /dev/sdx notation in your fstab. I’ve been meaning to investigate this method but have finally made to.


UUID or Universally Unique Identifier is a unique ID used in software where the number generate has a small chance of occuring twice. It’s like a random hexadecimal based on factors like time, mouse movement etc to generate the number and using those factors it can re-identify the class, object or in this case the HDD.

Hardware Abstraction

UUID overcomes the lack of hardware abstration when referencing hardware. For example the HDD can be connected to any SATA / PATA socket and Linux (in general) names them in order of detection or in order of socket. If drive A was plugged into SATA 1 then Linux would recognise it on /dev/sda. If Drive A is re-plugged into SATA 2 the drive might change to /dev/sdb. The UUID over comes the changes to drives from a physical point of view. It labels the drive it self and therefore the same drive would have the same ID no matter which socket or device point.

Mount Using UUID

In Ubuntu 8.04 including previous and newer versions store the mount points in /etc/fstab file. It’s best to create a copy of this file incase something goes wrong:

sudo cp /etc/fstab ~/fstab.bak This will make a backup copy of fstab to your home directory.

To list the UUID for partitions connected to the system use the command sudo blkid. Copy the UUID for the partition you want and replace the directive /dev/sda1 (or the partition you want to replace / use) with the hexadecimal e.g:

/dev/hda11 /media/Macintosh_HD hfsplus rw,exec,auto,users 0 0

with UUID:

UUID=crj15eca-5b2s-48ad-9735-eae5ac14bc90 /media/Macintosh_HD hfsplus rw,exec,auto,users 0 0


It’s a much better way of letting the computer keeping tab of which HDD is which but can be harder for a human to tell which one is which.

Wikipedia UUID

Fstab Ubuntu Community Page

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply