This patch add support for a new tag. The tag is based on udev block
device ID (see /dev/disk/by-id). The usual use-case is to use
WWN for this purpose, for example
# mount ID=wwn-0x50026b724b09a1ff /mnt
Note that ID is not strictly defined and udevd generates various IDs
also for HW where WWN is undefined. This is reason why introduce ID=
seems better and more generic than more restrictive WWN=.
Addresses: https://github.com/karelzak/util-linux/issues/1008
Signed-off-by: Karel Zak <kzak@redhat.com>
const char *data;
int errsv = 0;
const char *data;
int errsv = 0;
+ if (strcmp(token, "ID") == 0)
+ return 0; /* non-content tag */
+
pr = blkid_new_probe();
if (!pr)
return -1;
pr = blkid_new_probe();
if (!pr)
return -1;
strcpy(dev, _PATH_DEV_BYPARTLABEL "/");
else if (!strcmp(token, "PARTUUID"))
strcpy(dev, _PATH_DEV_BYPARTUUID "/");
strcpy(dev, _PATH_DEV_BYPARTLABEL "/");
else if (!strcmp(token, "PARTUUID"))
strcpy(dev, _PATH_DEV_BYPARTUUID "/");
+ else if (!strcmp(token, "ID"))
+ strcpy(dev, _PATH_DEV_BYID "/");
else {
DBG(EVALUATE, ul_debug("unsupported token %s", token));
return NULL; /* unsupported tag */
else {
DBG(EVALUATE, ul_debug("unsupported token %s", token));
return NULL; /* unsupported tag */
int mnt_valid_tagname(const char *tagname)
{
if (tagname && *tagname && (
int mnt_valid_tagname(const char *tagname)
{
if (tagname && *tagname && (
+ strcmp("ID", tagname) == 0 ||
strcmp("UUID", tagname) == 0 ||
strcmp("LABEL", tagname) == 0 ||
strcmp("PARTUUID", tagname) == 0 ||
strcmp("UUID", tagname) == 0 ||
strcmp("LABEL", tagname) == 0 ||
strcmp("PARTUUID", tagname) == 0 ||
Partition universally unique identifier. This identifier is independent on
filesystem and does not change by mkfs or mkswap operations It's supported
for example for GUID Partition Tables (GPT).
Partition universally unique identifier. This identifier is independent on
filesystem and does not change by mkfs or mkswap operations It's supported
for example for GUID Partition Tables (GPT).
+.TP
+ID=\fIid\fR
+Hardware block device ID as generated by udevd. This identifier is usually
+based on WWN (unique storage identifier) and assigned by the hardware
+manufacturer. See \fBls /dev/disk/by-id\fR for more details, this directory
+and running udevd is required. This identifier is not recommended for generic
+use as the identifier is not strictly defined and it depends on udev, udev rules
+and hardware.
.RE
.sp
The command \fBlsblk \-\-fs\fR provides an overview of filesystems, LABELs and UUIDs
.RE
.sp
The command \fBlsblk \-\-fs\fR provides an overview of filesystems, LABELs and UUIDs
to verify that the UUIDs are really unique in your system.
The recommended setup is to use tags (e.g.\& \fBUUID=\fIuuid\fR) rather than
to verify that the UUIDs are really unique in your system.
The recommended setup is to use tags (e.g.\& \fBUUID=\fIuuid\fR) rather than
-.I /dev/disk/by-{label,uuid,partuuid,partlabel}
+.I /dev/disk/by-{label,uuid,id,partuuid,partlabel}
udev symlinks in the
.I /etc/fstab
file. Tags are
udev symlinks in the
.I /etc/fstab
file. Tags are
.I /etc/fstab
file if both
.I device
.I /etc/fstab
file if both
.I device
-(or LABEL, UUID, PARTUUID or PARTLABEL) and
+(or LABEL, UUID, ID, PARTUUID or PARTLABEL) and
.I dir
are specified. For example, to mount device
.BR foo " at " /dir :
.I dir
are specified. For example, to mount device
.BR foo " at " /dir :
" LABEL=<label> specifies device by filesystem label\n"
" UUID=<uuid> specifies device by filesystem UUID\n"
" PARTLABEL=<label> specifies device by partition label\n"
" LABEL=<label> specifies device by filesystem label\n"
" UUID=<uuid> specifies device by filesystem UUID\n"
" PARTLABEL=<label> specifies device by partition label\n"
- " PARTUUID=<uuid> specifies device by partition UUID\n"));
+ " PARTUUID=<uuid> specifies device by partition UUID\n"
+ " ID=<id> specifies device by udev hardware ID\n"));
fprintf(out, _(
" <device> specifies device by path\n"
fprintf(out, _(
" <device> specifies device by path\n"