59

How to edit label of USB drive easily without formatting it? I tried right clicking the device and go to the properties but cannot find anything to edit.

αғsнιη
  • 35,660
Namshum
  • 1,765

6 Answers6

52

From Terminal

You have to use the mlabel command.

  • First type the mount command to find out the device location of you pen drive. Find the line which goes like “/dev/sdc1 on /media/disk …”.

  • This means the device sdc1 which is my pen drive is mounted on /media/disk.

  • Next unmount the device.

    sudo umount /media/disk

  • Next use this command.

    sudo mlabel -i /dev/sdc1 ::<new_label>

If you get a message like:

Total number of sectors (7831520) not a multiple of sectors per track (63)! You can easily ignore the check by running this command:

echo mtools_skip_check=1 >> ~/.mtoolsrc

Try again and it should work.

  • The name of the USB should have changed. Unplug and Plug the pen drive back in and it will be mounted with the new label name.

The GUI way

  • For this you need the Gparted software. Install it if you don’t have it already.

  • Open the software as a super user, and select the pen drive from GParted>Devices>

  • Unmount the device if it hasn’t been, by right clicking on it.

  • After unmounting, right click on it and select “Label” and change it to whatever you want it to be. And then Apply it, by clicking the Edit>Apply All Operations.

  • Your pendrives label should be changed now.

Original Source

guntbert
  • 13,134
karthick87
  • 81,947
  • 1
    I am using sudo mlabel -i /dev/sde1 :: but getting the error bash: syntax error near unexpected token `newline' – Namshum Sep 30 '12 at 07:59
  • 2
    The GUI way works out as per the steps you mentioned. Thanks! – Namshum Sep 30 '12 at 08:27
  • Note that if you are using the command line technique, you may need to enclose the mount point in quotes to unmount it, viz:

    sudo umount "/media/STORE N GO"

    – K. P. MacGregor Apr 02 '14 at 23:40
  • 1
    In my case, I had to add MTOOLS_SKIP_CHECK=1 to the /etc/mtools.conf to get it working (~/.mtoolsrc din't exist). Good answer anyway. It works fine. – cabreracanal May 08 '14 at 14:30
  • ~/.mtoolsrc doesn't work here since it goes to the users home directory. you have to edit /root/.mtoolsrc (or the config) – relascope May 28 '15 at 14:49
  • If you use GParted you still need mtools package. – a06e Aug 03 '15 at 17:29
  • @karthick87 Can't I give image in the label using mlabel? see https://lifehacker.com/188852/assign-a-custom-icon-to-your-flash-drive – alhelal Nov 28 '17 at 12:36
19

You got several options (some require installation). Out of these e2label should be the easiest.

Gparted

Gparted can do this. Rightclick the device and choose label. Needs installation of gparted though.


There are several command line methods:

tune2fs - Adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems

Example: sudo tune2fs -L {label} {devicename}


e2label - Change the label on an ext2/ext3/ext4 filesystem

Example: sudo e2label {device} {label}


There is also the Windows method:

mlabel - make an MSDOS volume label

Add a line in the /etc/mtools.conf file like this drive {letter}: file="{device}". Example: drive p: file="/dev/sdb1". Note that the drive letter can be replaced by any letter that is not present in the mtools.conf file.

Example to set the label: sudo mlabel {letter}:{label}

Rinzwind
  • 299,756
11

As well as the other answers, the more ubiquitous tool dosfslabel is well suited to this task;

dosfslabel /dev/sdd1 "My Label"

where /dev/sdd1 is the partition you wish to label.

Riot
  • 266
5

I did a little research and I found this official tutorial from Ubuntu Documentation which will teach you step by step how to rename drives with different file systems (FAT16, FAT32, NTFS, ext2, ext3, ext4, JFS, ReiserFS (v3) and XFS).

The title is "RenameUSBDrive", but it is not only for USB drives, it covers a lot of file systems supported by Ubuntu.

Here is the link: https://help.ubuntu.com/community/RenameUSBDrive

Bernmeister
  • 1,231
Zignd
  • 10,812
0

Gparted and Mlabel did not work on Ubuntu 18.04 renaming a FAT USB drive. However, you can use fatlabel instead :

sudo fatlabel /dev/sdd1 NEWNAME
Eliah Kagan
  • 117,780
linuxmarc
  • 119
0

Another GUI way if you're using Gnome.

  1. run gnome-disks or search for "Disks" in the app search

  2. Choose the device

  3. choose the partition, click the gear icon

    enter image description here

  4. Modify the Display Name field

    enter image description here