You are not logged in.

#1 2019-09-17 09:49:22

StopkaPeter
Member
Registered: 2019-05-20
Posts: 20

PARTUUID instead UUID in fstab, Pros / Cons ?

Hi, I want ask you for advice. In arch installation wiki is recommended use UUID when is generated fstab:

# genfstab -U /mnt >> /mnt/etc/fstab

I want change UUID to PARTUUID with command:

# genfstab -t PARTUUID /mnt >> /mnt/etc/fstab

Is there any Pros or Cons to using PARTUUID over UUID?

I want change this, because when goes something wrong with my system, I can easly format root partition and run rsync from my backup. Unfortunately when partition is formated, then UUID is changed and I must manually change fstab to new UUID numbers and I don't know if any other files will need to be modified too.

Thank you.

Offline

#2 2019-09-17 10:37:27

WSDMatty
Member
Registered: 2019-08-27
Posts: 14

Re: PARTUUID instead UUID in fstab, Pros / Cons ?

From what I understand (which isn't much) there would be effectively no real difference. As you stated, UUID is a function of the filesystem, and anytime you run mkfs on the partition the UUID changes. But PARTUUID is a function of the partition table in GPT partition tables. That will stay static unless you repartition your drive.

The main difference is that UUIDs are globally unique whereas PARTUUIDs are locally unique. You'll never run into a PARTUUID conflict on the same machine. But if you swap out a drive from another machine, you could potentially run into naming conflicts.

Offline

#3 2019-09-17 11:44:22

frostschutz
Member
Registered: 2013-11-15
Posts: 819

Re: PARTUUID instead UUID in fstab, Pros / Cons ?

PARTUUID identifies a partition. If you decide to use the partition for something else (format it), it'll still be identified even though the content is no longer there, and it might get mounted to the wrong place. Or the other way around, if your partition table had an issue, and you end up re-creating the same partitions (with different partuuids), it'll no longer be identified even though the content is still there. Only partitions have PARTUUIDs, you don't have them for other block devices (like LVM) so that's a disadvantage. Mounting by PARTUUID works without initramfs so that'd be an advantage if you wanted to make an initrd-free system.

UUID identifies a filesystem by content. If the UUID is found, the filesystem is there. And it doesn't matter if it's a whole block device, partition, raid, luks or lvm. UUID works on all layers, PARTUUID only for partitions.

In general fstab entries are about mounting specific content to specific locations so identifying by content rather than by partition is more natural. It's a lot more common to use UUIDs.

The downside of UUIDs is that you have to scan all devices for content to find them. After all the UUID could be anywhere. With PARTUUID you only check the partition tables, so it's easier/more performant. But you'd need a ton of block devices for that to make a difference.

But at the end of the day, either one might work so it's a matter of taste. And there are special applications where UUIDs just don't work, for example if you want to mount an USB stick plugged into a specific USB port to a specific location, no matter which stick is plugged (you need by-path instead of any kind of uuid).

The main difference is that UUIDs are globally unique whereas PARTUUIDs are locally unique.

If you use PARTUUID you should also consider GPT which has proper per-partition uuids rather than the MSDOS partition scheme which just does partition numbers really.

Last edited by frostschutz (2019-09-17 11:47:07)

Offline

#4 2019-09-17 12:06:36

nl6720
Wiki Admin
Registered: 2016-07-02
Posts: 165

Re: PARTUUID instead UUID in fstab, Pros / Cons ?

StopkaPeter wrote:

I want change this, because when goes something wrong with my system, I can easly format root partition and run rsync from my backup.

Most mkfs.* utilities support specifying the UUID. You can create a new file system and with the old UUID. E.g.:

# mkfs.ext4 -U INSERT_UUID_HERE /dev/sdXY
# mkfs.xfs -m uuid=INSERT_UUID_HERE /dev/sdXY
# mkfs.btrfs -U INSERT_UUID_HERE /dev/sdXY
# mkfs.fat -i INSERT_UUID_HERE /dev/sdXY

Offline

Board footer

Powered by FluxBB