Successful booting with UUID
Guide to use UUID for consistent booting.
When your system boots, the kernel looks at the fstab file to learn which partitions are available and where these should be mounted in the tree. Since the dawn of time, Unix time anyway, the convention was to list each partition from /dev. This works quite alright if you have only a single disk in your system, but modern computers, servers included, have an increasing amount of disks connected to their hardware and with that, the chance of 'getting it wrong' increases significantly. The result is a kernel panic! Fortunately, Linux has a solution: UUID or Unified Universal IDentification. It works this way: each time a partition is created, the partitioning tool also creates a random, large, unique number for it and assigns this to the partition. Due to its size, it's highly unlikely another partition in the machine will have the exact same number assigned to it. By using this UUID number in fstab the kernel can locate the correct partition to mount in the tree at the correct place and do so consistently. So, it's a good idea to use this UUID stuff, right? But how? Well, that's exactly the purpose of this guide.
Preparing your system
As is common in Linux, everything is a file (except for networking stuff, but that's beyond the scope of this guide) and so is the /etc/fstab file. To be safe, copy the contents of this file to a backup location.
# cp /etc/fstab /etc/fstab.bak
Next, obtain the UUID's of each partition in your system. For that, we have the blkid command:
# blkid /dev/sd* >> /etc/fstab
Next thing is to edit the fstab file so it resembles this example:
#/dev/sda1 /boot jfs defaults 1 2 UUID=4fec87f4-b4ad-4707-a1ef-3dd2dd0108c5 /boot jfs defaults 1 2 #/dev/sda2 / jfs defaults 0 1 UUID=95ca00ac-d0a4-4a80-ba44-4a615a6dc6a4 / jfs defaults 0 1 #/dev/sda5 none swap sw 0 0 UUID=4ab5f71d-a26a-4438-b66f-beee4d9c61a7 none swap sw 0 0 #/dev/sda6 /home jfs user,noauto 0 2 #UUID=10fa710a-9cbc-4cc4-b4d1-fc1d6b4d4ff6 /home jfs user,noauto 0 0
Obviously, the UUID numbers will differ on your system and most likely so is the partitioning and perhaps the file system (jfs in this example) used. As you've noticed, both methods of designating partitions are present, shown for comparison only, with the /dev/sdX entries commented out. Once you've established your Funtoo system works with the UUID entries, you can remove the /dev/sdX lines. But it won't hurt if you leave them in place, just make sure they remain commented out.
Double-check the entries and syntax are correct, then reboot. When your Funtoo system boots, congrats! You now have a system that always mounts the partitions in the tree consistently and correctly.
Expanding your system
If you add more drives to your system, updating /etc/fstab is fairly straightforward. First, obtain which drive designation (following the /dev/sdX convention) the new drive has:
Assuming your new hard drive is sdb, run the blkid command again:
# blkid /dev/sdb >> /etc/fstab
Then edit /etc/fstab as before, making sure the directory where you want to mount it in the tree exists.
The guide assumes you use SATA drives in your system, which is the de-facto standard on modern systems. If you're still using older IDE drives, you'll need to change the sdX references to hdX.
Browse all our available articles below. Use the search field to search for topics and keywords in real-time.