In previous posts, I've mentioned a bit about my Plex media server. Up until now, I've just been running two Western Digital drives labeled as /dev/sda1 and /dev/sdb1 in my /etc/fstab.

This is generally not a great setup, as using device assignments such as /dev/sd*# or /dev/hd*# can change in certain situations, potentially causing all sorts of issues. So far, it's been adequate for me but I'd like to add some more drives in the near future so I need to clean this up. To do so, instead of using the /dev/sd*# device assignment you see above, I'll be using the UUID (Universally Unique Identifier) for each drive. Doing this will let me not have to worry about device assignments shifting around in between boots and causing frustration later down the road. To do so is fairly simple.

First, we'll make note that the drives we're interested in finding UUID's for are /dev/sdb1 and /dev/sda1. Now that we have that info, we'll run the command ls -hAlF /dev/disk/by-uuid/ to get an output of our UUIDs for each of our drives. Here's an example of my output:

We can see that the text in green is the UUID for each of our devices. From here, it's as simple as going back to our /etc/fstab and changing our setup to use the UUIDs at the beginning of each line.

The new and improved /etc/fstab, using UUIDs to reference the storage devices

As you can see, I simply replaced /dev/sd*# with the UUID of the corresponding device. Once having saved it, I rebooted the server to have the changes go into effect.

That's all there is to it!