Howto : Change Volume Label On USB drives In Linux

September 28, 2012 | By
| Reply More

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 article, 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.

Case1: USB device is a flash card with FAT32 filesystem

For FAT16 and FAT32, we need to use the “mlabel” command to set volume 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. Now, you can change the label using the following command.

sudo mlabel -i /dev/sdb1 ::new_name

Case2: The USB device is Linux Formatted Drive with 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

Filed Under : HOWTOS, LINUX HOWTO

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.