In this video you'll learn about labels and UUIDs. We already talked about it, so you
already know why. It all has to do with device naming. Device names are generated by SystemD
UDFD when the system is booting. And changes to hardware topology may result in changed
device names. We have seen that. When I added a couple of NVMe devices and rebooted my system,
suddenly the disk previously known as NVMe0n1 had become NVMe0n3. So if you have hard-coded
device names in your ETCFS step, it will fail dramatically and you can start troubleshooting.
That's not a good idea. And that is why you can use UUIDs and labels. UUIDs are automatically
assigned while creating the file system. If at any time you don't see a UUID, well, the
solution is simple. You haven't created the file system in that case. You can find BLKID
to be pronounced as block ID to find currently existing UUIDs. Labels are human understandable
labels that are written to the file system. And you need to create them yourself with
the appropriate utilities. And the utility that you are going to use depends on the file
system that you want to use. You use mkfs.whatever. It works for any file system with the uppercase
L option to set a label while creating the file system. Or tune 2fs minus uppercase L
to set the label on an existing EFC file system. And you can use XFS underscore admin minus
uppercase L to set the label on an existing XFS file system. Now talking about XFS, you
might get in a situation where you have duplicate UUIDs. This will happen if you clone a device.
Because if you clone a device, you make an exact block by block copy of the contents
of your device. And then the UUIDs are cloned as well. And the result might be duplicated
UUIDs. And these prevent the file systems to be mounted properly. Now if you want to deal with
that situation, you use the mount option no UUID. Or you just ignore the UUID and mount
device name by device name or label. But that's a temporary situation. The nice situation is to
use XFS admin minus uppercase U generate. That will generate new UUID on an XFS file system.
Alternatively, there is UUID gen to generate a new UUID. And tune 2fs minus uppercase U to work
with the new generated UUID, which next can be set on the device. So UUIDs normally are generated
automatically, but you can generate them manually as well, which can be handy in some cases.