Linux: Mount Disk Partition Using LABEL

How do I mount the filesystem (disk partition) using the filesystem label on the ext3/ext4 file system located on USB disk or hard disk under Linux operating systems?

The e2label command will display or set the filesystem label. The mount command has the option to mount partition that has the specified label. To see your current label type the following command:
# e2label /dev/sdc1
Sample outputs:

ADVERTISEMENTS

seagate_2tb_usb

Syntax: Mount Command With Label

The syntax is as follows:

mount -L label_name_here /path/to/mount/point

To mount the /dev/sdc1 using the seagate_2tb_usb label at /media/usb, enter:
# mkdir -p /media/usb
# mount -L seagate_2tb_usb /media/usb
# df -H

Sample outputs:

Filesystem             Size   Used  Avail Use% Mounted on
/dev/md0               127G   902M   120G   1% /
tmpfs                  1.1G      0   1.1G   0% /lib/init/rw
udev                   1.1G   267k   1.1G   1% /dev
tmpfs                  1.1G      0   1.1G   0% /dev/shm
/dev/md2               1.6T    81G   1.5T   6% /data
/dev/mapper/cryptvg-mybackup
                       635G    48G   555G   8% /securebackup
/dev/sdf1              2.0T   858G   1.1T  46% /media/usb

Please note that my actual device name is /dev/sdf1. Feel free to replace actual label names and mount point as per your requirements.

Update /etc/fstab File

You can update the /etc/fstab file as follows to mount it automatically using the disk label:

LABEL=seagate_2tb_usb     /media/usb    ext3   defaults 0 0

See also:

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
3 comments… add one
  • Paul M Nov 4, 2011 @ 14:20

    mount /dev/disk/by-label/SOMEDISKNAME /mnt/foobar

    or put this in fstab

    LABEL=SOMEDISKNAME /mnt/foobar vfat users,uid=1000,gid=users,umask=0002,utf8=true 0 0

  • Feji Thomas May 15, 2014 @ 4:20

    How do i find the Label if the disk failed? We have no option from the /etc/fstab to identify the disk/partiotion information!!

  • Desmond Sep 24, 2014 @ 7:20

    I am on ubuntu 14.04 LTS. The e2label works fine.

    However I am not able to see the device in Nautilus files, under devices.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.