How to Change Volume Label of USB Drives on Linux

Usb label

When a USB device such as USB hard drives, flash memory card is connected to a Linux machine, it will get automatically mounted at /media/disk, /media/disk1 etc. It will be useful if we can label it with an identifiable name, so that we will be able to recognize the device easily in case multiple devices are connected. In this tutorial, we will see how a USB drive (FAT16/FAT32 or ext2/ext3/ext4 partitions) can be labeled.

After connecting the USB drive, you will be able to find the device using fdisk command.

# fdisk –l

Suppose, the USB device is /dev/sdc1.

USB Flash Card (FAT32 filesystem) using mlabel

For FAT16 and FAT32, we need to use the “mlabel” command to set or change volume label name. This command is provided by the “mtool” package. So, we need to install this package first.

sudo apt-get install mtools

Before changing the label we need to unmount the device.

# sudo umount /dev/sdc1

Now, we can proceed with changing the label using “mlabel”.

1. You can check the current label as follows.

sudo mlabel -i /dev/sdc1 -s ::

2. Update mtools.conf file

Now, add a line in a file /etc/mtools.conf file:

Drive p: file=””

Example: drive p: file=”/dev/sdc1”

Here, we can replace any alphabet in place of “p”

3. Now, you can change the label using the following command.

sudo mlabel -i /dev/sdb1 ::new_name

If USB device is Linux Formatted Drive (ext3 filesystem)

For ext2/ext3/ext4 filesystems, we need to use e2label command. This is provided by the package e2fsprogs. So, we need to install this package first.

sudo apt-get install e2fsprogs

Before changing the label we need to unmount the device.

# sudo umount /dev/sdc1

Now, we can proceed with changing the label using “e2label” as follows.

1. You can check the current label as follows.

sudo e2label /dev/sdc1

2. Now, you can change the label using the following command.

sudo e2label /dev/sdb1 new_name

For graphical method to change the volume label, you have to install and use gparted utility.

Bobbin Zachariah 8:18 pm

Comments

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.