A compilation of documentation   { en , fr }

Partition identifiers on Linux

Created on:
Last edited on:
Xavier Béguin

Limits of the traditional partition naming system

On GNU/Linux systems, partitions have long been mounted using filenames of block special devices used on Unix-type systems to access storage devices, for example /dev/sda1, /dev/sdc3, etc.

This method works well for most cases, but can sometimes cause a problem as device names of disk partitions can change after a reboot because of a hardware change or reconfiguration.

It could be the case for example when an USB device is connected at the same time as another device rather than alone, or when a new disc is added to the system and is detected at boot before the disk already in place. In these cases, the block device name previously used by a partition will change after reboot, and the system will no longer recognize the partition or will try to mount a different partition that uses the old partition name, sometimes causing errors that will prevent the system from booting.

The alternative partition identifiers

To work around this issue, other means to designate a partition or filesystem exist that can (in some cases) be more durable in time. These names are accepted by some pieces of software that access partitions, like boot loader program (such as GRUB) or the mount command.

The manual page mount(8) of the mount command lists the types of filesystem and partition identifiers it supports (for a command line usage or through the file /etc/fstab) as a substitute for block device names. Here is a summary of this list:

  • LABEL=label : uses a label defined by an administrator for the filesystem to se (if one was defined). On the command line, the option -L can also be used to specify the label (omit the LABEL= part in this case);
  • UUID=uuid : uses the Universally Unique IDentifier (UUID), generally a series of hexadecimal digits separated by hyphens, automatically defined in most filesystems. The hexadecimal characters must be specified in lower case. On the command line, the option -U can also be used to specify the UUID (without the UUID= part).
  • PARTLABEL=label: uses a label defined by an administrator for a partition in the GUID partition table (GPT), independently from the filesystem;
  • PARTUUID=uuid : uses an UUID automatically defined for a partition in the GUID partition table (GPT), independently from the filesystem;
  • ID=id : uses the identifier of the hardware block device created by udev (be cautious as this identifier depends on udev, on its ruls and on the hardware, and is not recommended for general use).

Note that the type of identifiers to use should be chosen wisely as some depend on the hardware, and other can in some cases be non-unique (see the frame below).

Filesystem UUIDs are however the most common identifiers, and is incidentally often used by default in many GNU/Linux distributions.

Identifiers based on the filesystem are the most practical ones but should be used with caution though: when cloning a filesystem, the identifier is not modified and will therefore stop being unique in the system.

A partition specified using an non-unique identifier will not be mounted by the sytem, which can prevent the system from booting correctly. This is the case with filesystem UUIDs, and more so with filesystem labels managed by administrators (whose usage is usually not recommended).

In practice, using mount, a partition whose label would be VMSTORAGE can be mounted from the command line using the following command:


The identifier LABEL=VMSTORAGE can also be used as a substitute for, for example, /dev/sdc2 in the file /etc/fstab (see the manual page fstab(5) for more detail on this subject).

Filesystem labels must be set or modified using specialized tools for each filesystem type. They can be, for example:

  • for ext2/3/4 filesystems: e2label /dev/sdc3 MYLABEL or tune2fs -L MYLABEL /dev/sdc3;
  • for FAT systems: fatlabel /dev/sdc2 MYLABEL (fatlabel was previously known as dosfslabel);
  • for NTFS filesystems: ntfslabel /dev/sdc2 MYLABEL;
  • for swap partitions: swaplabel -L MYLABEL /dev/sdc2;
  • for LUKS partitions : cryptsetup config /dev/sdc2 --label MYLABEL (this command only works for LUKS2 partitions).

Some of these commands also allow for modifying the filesystem UUID, although this is less useful as this identifier is not meaningful and is usually unique.

Listing existing filesystems

The following command lists the different partitions available in the system and their identifiers (which allows for visually verifying their unicity):


The variant below only prints information on filesystems and their UUID and optional label (the tow version of the command are identical, --fs being an handy alias):

lsblk --fs

The command partx can be used to print UUIDs and labels defined in the GUID partition table, i.e. GPT (therefore the PARTUUID and PARTLABEL identifiers):

partx --show /dev/sda

Lastly, the command findfs allows to seek a block device filename of a partition using the tags of the identifiers:

~# findfs UUID=dfc81e29-6d74-3388-8924-370db61ebc6c

Other software or commands, however, only support block device filenames (such as /dev/sda1, etc.). In theses cases, it's still possible to use the identifiers described above thanks to the symbolic links dynamically created under the subdirectories of /dev/disk by udev, the device manager for the Linux kernel.

/dev/disk contains several subdirectories that provide symbolic links that use, depending on the subdirectory, one of the type of identifiers described above. The targets of these links are the block devices of the partitions:

├── by-id
├── by-label
├── by-partlabel
├── by-partuuid
├── by-path
└── by-uuid

Links in the by-path subdirectory use names that designate the hardware connector the device is connected to, eventually with a partition number, for example pci-0000:00:1f.2-ata-1.0-part1. They are not supported by mount.

These symbolic links can be used wherever traditional block device partition names can be. For example, to simply mount a partition from the command line, one could use a command such as the following:

mount /dev/disk/by-label/VMSTORAGE /mnt

Or, using a filesystem UUID, one could use:

mount /dev/disk/by-uuid/2232ac39-351d-47db-a649-f16385a5ebec /mnt

In software that support them, it is recommended to use tags (e.g. UUID=uuid) rather the symbolic links /dev/disk/by-{label,uuid,partuuid,partlabel} as tags are more readable, robust and portable.

If you change for example the label of a filesystem, symbolic links under /dev/disk/by-label will usually be immediately updated by the device manager udev.

Sometimes though, these links seem to not get updated (at least it happened to me some years ago). To force this update, a system reboot is not required (which could be a problem in the case of a busy server). The following command allows for forcing this update, for example here for the sdg partition:

echo add > /sys/block/sdg/uevent

This tip was found on the site pieter.barrezeele.be and I could successfully validate it. The action change seems more appropriate than add and could probably be enough, but I don't have the possibility to verify this point any more.

The command udevadm should at first glance but the same thing (but I cannot verify this in real condition):

udevadm trigger /dev/sdg

The action triggered by default by the above command is change. Should it not be enough, an add action can be selected by specifying it explicitly:

udevadm trigger --action=add /dev/sdg

See the manual page udevadm(8) for more details.