how to Linux: Mount Disk Partition Using LABEL

In Linux, you can use the mount command to mount a disk partition by its LABEL, rather than by its device name. The LABEL is a human-readable string that is assigned to the partition, and can be used to identify it.

Here is an example of how to mount a partition with the LABEL “data” on the /mnt/data directory:

sudo mount -L data /mnt/data

You can also use the -o option to specify additional mount options, for example:

sudo mount -o rw,noatime -L data /mnt/data

This command mounts the partition with the LABEL “data” with read-write access and the noatime option (which will reduce disk writes and improve performance) on the /mnt/data directory.

You can check the LABEL of a partition by using the lsblk -o name,label,mountpoint command, it will display name, label and mount point of all the partitions.

You can also use the blkid command to list the LABELs of all the partitions:

sudo blkid

You can also use the findfs command to find the device name by LABEL and then use that with mount command.

sudo mount $(findfs LABEL=data) /mnt/data

Please note that you need to have the necessary permissions to mount the partition on the specified directory. Also, the mount point should exist before mounting the partition

Leave a Comment