I am in the process of creating a backup script. First of all, I would like to make sure the source file-system/logical-volume is mounted (and know where it is mounted).
Apparently this can be done using both the file-system's UUID and the logical volume's UUID (Check logical volume mount point (command line)).
I would like to know which one should I be using and why (if there is any reason to prefer one over the other). Could there be any real difference?
In my case, I always create a single partition in each logical volume (filling up the logical volume space), but I do not know if other setups are possible that would allow more complex configurations.
Best Answer
It depends on what you really care about.
If you want to see if a specific filesystem is mounted, you use the filesystem UUID. Because that's what identifies the filesystem itself. That's usually the default choice for everyone: People care about specific filesystem, and not which partition, volume, disk those reside on. It could be a network block device, who cares, as long as it's there.
Now, if you don't care about the filesystem at all - guess what, someone ran
mkfs
yesterday and made a new one - you might check the VG/LV name, or if you don't care about name changes either, the logical volume UUID. Or PARTUUID when not using LVM.The deeper down you go the farther away you will be from the filesystem itself. There's also
/dev/disk/by-path
which you could use to identify a USB stick plugged into a certain USB port and not care which USB stick it is that was plugged in there. And sometimes that may be what you want.But usually you just stick to the filesystem UUID.