What is the difference between a partition name and a partition label?

Solution 1:

The GPT disk format can simply contain more data than its predecessors. One of these fields is the partition name, which, as you have found, can be set by gdisk or similar. However, before GPT, there were formats which didn't support labels in the partition table (e.g. MBR), so the data was stored in the fs as a filesystem label. Using GPT with a filesystem that supports labels (i.e. basically anything) therefore produces the slightly confusing combination of partition name/label and filesystem name/label.

These values are totally independent, (although I don't exactly recommend making them totally different) and most programs will use the fs label, as that one is available across basically all file systems, unlike the partition name, which is only on GPT. However, some programs can use the partition name too. (E.g. /dev/disk/ contains by-label/ as well as by-partlabel/.)

I'm not quite sure as to why you'd ever have to use the partition label, but a contrived example could be an encrypted /home partition. Because the partition is encrypted, the label (or UUID for that matter) cannot be extracted without decrypting it first. (Note that common containers do support these values.) Therefore, you'd have to hardcode the partition number somewhere. Because no one likes hardcoded numbers, you could instead set the partition label and access the partition like that when you decrypt.