0

What does the concept of disk label mean?

Does it mean the same as partition table type (MBR, GPT, loop, etc)? (as I suspected from the following output of parted, and in my previous post)

Or does it mean a name given to a disk?

Thanks.

$ sudo parted -l
Model: ATA TOSHIBA MQ01ABF0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name                  Flags
 1      1049kB  538MB  537MB  fat32        EFI System Partition  boot, esp
 2      538MB   500GB  500GB                                     lvm


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/lubuntu--vg-swap: 4295MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system     Flags
 1      0.00B  4295MB  4295MB  linux-swap(v1)


Error: /dev/mapper/lubuntu--vg-home: unrecognised disk label
Model: Linux device-mapper (linear) (dm)                                  
Disk /dev/mapper/lubuntu--vg-home: 444GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/lubuntu--vg-root: 51.5GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  51.5GB  51.5GB  ext4
4

Yes, it's confusing:

  • There's the label inside partitions (more correctly inside filesystems) just called LABEL by lsblk -f [On all disks but not for special partitions like swap, procfs, sysfs]
  • There's the label outside partitions but in the partition table called PARTLABEL by lsblk -f [Only gpt disks have this capacity]
  • There's the label outermost which as you rightly suspect is more usually called 'partition table'. This last terminology is more used in other Unix cultures eg OpenBSD , Oracle and BSD. Unfortunately the 'unrecognised disk label' that you've stumbled on seems to be this case.

Some etymology/history

  • Early filesystems did not agree on labels or even having labels. Also remaking a filesystem would lose the (FS) label. So a level of label outside FSes but inside the partition table was added in gpt disks.
  • If we were starting over the PARTLABEL would be called LABEL and the (old-fashioned) LABEL maybe InternalLabel or Docu or something else or absent altogether. We don't have that luxury because

    1. Facts of history are not negotiable — (most of us don't have access to a time machine!)
    2. Many of us are still using the old (MBR) hardware right now
    3. Nevertheless labeling a bottle inside the bottle is confusing.
  • In the case of the outermost label, treat it as closer to the English word "format" than "label" i.e. you buy a new disk and prepare it for use by the OS. Nowadays we say format the disk. Earlier *nixers said: label the disk

Why Confusion

Every Linux user (or at least Linux user who administers his own machine) needs to deal with 4 levels which can be confusing enough!

  1. Hardware disk
  2. Partition table (gpt table)
  3. Partitions
  4. File systems

Each n+1 nests inside the above n

By using LVs you are adding more level(s), which can be levels of confusion.

My

Friendly Advice

Until you get the above don't use LVs.

1

Label is actually a property of a filesystem into which a partition or the whole drive is formatted. If you format a USB drive with new filesystem, you will notice that label has changed. Often when manually formatting a drive, such as via one of mkfs versions you can specify a -n flag, as shown in this answer.

But what's the purpose of the label ? Here's an excerpt from Arch Wiki :

If your machine has more than one SATA, SCSI or IDE disk controller, the order in which their corresponding device nodes are added is arbitrary. This may result in device names like /dev/sda and /dev/sdb switching around on each boot, culminating in an unbootable system, kernel panic, or a block device disappearing. Persistent naming solves these issues.

In other words, a device label helps with system maintenance. And obviously this is a more sysadmin-friendly way.

Let's look a little further:

by-label

Almost every filesystem type can have a label. All your partitions that have one are listed in the /dev/disk/by-label directory. This directory is created and destroyed dynamically, depending on whether you have partitions with labels attached.

So if you're maintaining a complex system, this can be very useful to identify a drive/partition by label instead of /dev/sda1 and /dev/sdb3 etc.

And here's one from Red Hat documentation:

The label can also be used to refer to the device in /etc/fstab using the following syntax:

LABEL=Boot

  • Thanks. The thing you talked about seems to be better named "filesystem label". "disk label" by name seems to be a property of a disk. – Tim Feb 27 at 2:18
  • @Tim Disks themselves don't store labels in their firmware chips. A system administrator can add label to filesystem but not to disk itself. It seems to be more of a confusion between Windows and Unix terminology, because in Windows even a partition seems to be referred to as disk (even though physically it is not, it's part of a disk). You can get drive model , though, via smartctl output ( see related question ). – Sergiy Kolodyazhnyy Feb 27 at 2:24
  • @Tim Names are just names. Human's knowledge system are so complex, you can't get the actual meaning of a concept simply by its name. – 炸鱼薯条德里克 Feb 27 at 3:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.