In Linux, you can mount a disk partition using its LABEL instead of its device name. This can be useful when the device name may change (e.g. between reboots), but the LABEL remains constant.
To mount a disk partition using its LABEL, you can use the -L
option with the mount
command, like this:
mount -L <LABEL> <mount-point>
For example, to mount a partition with the LABEL data
to the /mnt/data
directory, you can use the following command:
mount -L data /mnt/data
You can find the LABEL of a disk partition using the lsblk
command:
lsblk -o NAME,LABEL,SIZE,FSTYPE,MOUNTPOINT
This will display the disk partition information, including the NAME, LABEL, SIZE, FSTYPE, and MOUNTPOINT columns. Find the LABEL you want to use and substitute it in the mount
command above.
Note that the mount
command must be executed as root or with appropriate privileges, otherwise you will get an error.