Linux: Mount Disk Partition Using LABEL

by on September 22, 2011 · 1 comment· LAST UPDATED September 22, 2011

in

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:

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:

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 Paul M November 4, 2011 at 2:20 pm

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

Reply

Leave a Comment

Tagged as: , , , , , , , , , ,

Previous Faq:

Next Faq: