You are not logged in.

#1 2021-05-25 11:43:16

MickeyRat
Member
Registered: 2011-11-15
Posts: 135

[SOLVED] Why use UUIDs for lvm volumes?

I've seen people on here insist that you should always use UUIDs to identify disks in fstab and other system type places.  I can understand that for conventional partitions.  With those, you could move them to a different interface or even another machine and if you use the UUID all will be well.  However,  LVM volumes are ALWAYS going to be in /dev/mapper and they are ALWAYS going to have the same name.  It would seem to me that using UUIDs for LVM volumes adds a layer of confusion and no benefit.

I know genfstab in the arch install uses UUIDs and that works for LVM volumes.  If I developed the install, I'd do that too.  LVM installs are a minority case and adding extra code to handle them differently adds unnecessary complexity with little benefit to the install.  However, if I'm looking at fstab, I get more information if I see something like "/dev/mapper/vg1-root"  than if I see "UUID=bc4039f4-c4d7-43b1-b467-c6f6515461d8" and in this case, the UUID doesn't provide any benefit.

Am I missing something?

Last edited by MickeyRat (2021-05-25 14:17:04)


Some cause happiness wherever they go; others whenever they go.
- Oscar Wilde

Offline

#2 2021-05-25 12:25:24

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,212

Re: [SOLVED] Why use UUIDs for lvm volumes?

No, but you also aren't trying to identify disks.

See the Note in the article that's often linked in combination with such a suggestion: https://wiki.archlinux.org/title/Persis … ice_naming

Where do you see someone suggests to do this in combination with a LVM volume?

Last edited by V1del (2021-05-25 12:27:50)

Offline

#3 2021-05-25 13:13:17

MickeyRat
Member
Registered: 2011-11-15
Posts: 135

Re: [SOLVED] Why use UUIDs for lvm volumes?

V1del wrote:

No, but you also aren't trying to identify disks.

See the Note in the article that's often linked in combination with such a suggestion: https://wiki.archlinux.org/title/Persis … ice_naming

Where do you see someone suggests to do this in combination with a LVM volume?

I agree with you on the disk part and I would use the UUID in that situation but, not for LVM volumes. 

There's one example in the 2nd reply in this thread and the OP agrees that using the UUID is better.  I've seen similar exchanges before.

I really just want to know if there really is any advantage to using the UUID with LVM volumes because I don't see it.


Some cause happiness wherever they go; others whenever they go.
- Oscar Wilde

Offline

#4 2021-05-25 13:18:04

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,539

Re: [SOLVED] Why use UUIDs for lvm volumes?

MickeyRat wrote:

I know genfstab in the arch install uses UUIDs and that works for LVM volumes.  If I developed the install, I'd do that too.

What does "the install" mean here?

Offline

#5 2021-05-25 13:53:33

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] Why use UUIDs for lvm volumes?

You should think of that "people insist on using UUIDs" in the context of people using /dev/sda, sdb, sdc device names in their fstab. The insisting on UUIDs is perhaps more of a "do not use /dev/sda".

There are good arguments for the alternatives to UUIDs. Like you mention the alternatives seem nicer to use when editing an fstab file. Another argument: labels instead of UUIDs will help when restoring from backups. You can create new filesystems with the correct labels and then "cp -a" the backup over and you are done. With UUIDs, you will have to manually edit /etc/fstab and boot loader config to make things work.

Offline

#6 2021-05-25 13:54:08

MickeyRat
Member
Registered: 2011-11-15
Posts: 135

Re: [SOLVED] Why use UUIDs for lvm volumes?

Scimmia wrote:
MickeyRat wrote:

I know genfstab in the arch install uses UUIDs and that works for LVM volumes.  If I developed the install, I'd do that too.

What does "the install" mean here?

If you are installing Arch from scratch using the Arch install media, one of the steps is to generate the fstab.  The media has a procedure to do that called genfstab.  As far as I know, the generated fstab uses UUIDs in all cases.  At least it has every time I've used it.


Some cause happiness wherever they go; others whenever they go.
- Oscar Wilde

Offline

#7 2021-05-25 13:56:00

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,539

Re: [SOLVED] Why use UUIDs for lvm volumes?

MickeyRat wrote:

As far as I know, the generated fstab uses UUIDs in all cases.  At least it has every time I've used it.

No, it doesn't, you have to specifically tell it to use UUIDs. The Installation Guide even mentions this and gives you options. YOU CHOSE to use UUIDs.

Offline

#8 2021-05-25 14:06:56

MickeyRat
Member
Registered: 2011-11-15
Posts: 135

Re: [SOLVED] Why use UUIDs for lvm volumes?

Ropid wrote:

You should think of that "people insist on using UUIDs" in the context of people using /dev/sda, sdb, sdc device names in their fstab. The insisting on UUIDs is perhaps more of a "do not use /dev/sda".

There are good arguments for the alternatives to UUIDs. Like you mention the alternatives seem nicer to use when editing an fstab file. Another argument: labels instead of UUIDs will help when restoring from backups. You can create new filesystems with the correct labels and then "cp -a" the backup over and you are done. With UUIDs, you will have to manually edit /etc/fstab and boot loader config to make things work.

I think you've answered my question in a way.  I wanted to know if UUIDs provided any advantage with LVM volumes and what I'm seeing so far is that they don't.


Some cause happiness wherever they go; others whenever they go.
- Oscar Wilde

Offline

#9 2021-05-25 14:08:39

MickeyRat
Member
Registered: 2011-11-15
Posts: 135

Re: [SOLVED] Why use UUIDs for lvm volumes?

Scimmia wrote:
MickeyRat wrote:

As far as I know, the generated fstab uses UUIDs in all cases.  At least it has every time I've used it.

No, it doesn't, you have to specifically tell it to use UUIDs. The Installation Guide even mentions this and gives you options. YOU CHOSE to use UUIDs.

i did say as far as I know.  It's been a while (years) since I did an install.  So, I stand corrected.

Last edited by MickeyRat (2021-05-25 14:13:09)


Some cause happiness wherever they go; others whenever they go.
- Oscar Wilde

Offline

#10 2021-05-25 14:09:20

frostschutz
Member
Registered: 2013-11-15
Posts: 1,524

Re: [SOLVED] Why use UUIDs for lvm volumes?

volume groups and logical volumes can be renamed, but the UUID stays the same as long as the filesystem itself is not formatted, so for identifying filesystems, UUID is still better than LVM names

the device name could be the same, but you might have formatted it to put the LV to a different use, but if you don't use UUID it would still be mounted to the old location


there are good reasons to not use UUIDs as well. mounting by UUID will scan across all devices looking for that UUID, as a result it will wake drives up from standby. it may be preferrable to use static names, or /dev/disk/by-uuid/X instead of UUID=x to prevent such scans from happening.

Edit: also when doing dd copies or snapshots, UUID could end up duplicated, which may be a reason to not use UUID (or otherwise, find some way to change the UUID for the copies)


you can do it either way, but it has different results

it depends on what you want and how you want this to work. there is no right or wrong in this (it's only wrong if it stops working altogether wink

Last edited by frostschutz (2021-05-25 14:44:33)

Offline

#11 2021-05-25 14:16:39

MickeyRat
Member
Registered: 2011-11-15
Posts: 135

Re: [SOLVED] Why use UUIDs for lvm volumes?

I think this one is as solved as it's going to get and I see the potential for a can of worms.  So, I'm marking the thread solved.


Some cause happiness wherever they go; others whenever they go.
- Oscar Wilde

Offline

Board footer

Powered by FluxBB