Take the 2-minute tour ×

I have a computer with Ubuntu installed. By default the hard disk name consists of a sequence of numbers and letters, which is not easy to remember nor input into a terminal.

How can I change the hard disk name in Ubuntu? Which file do I need to change?

share|improve this question
Do you mean the path to the device (/dev/sdb1), UUID (550e8400-e29b-11d4...) or the label/name of a partition? –  Bobby Apr 8 '10 at 9:11
path to device as i understood is correct, nothing special. UUID has different mask, not the name. I mean label/name under "/media" folder. do you understand? –  alex Apr 8 '10 at 9:20
sorry, i just install gparted and i was wrong, i need to change UUID, because UUID and label/name under /media is same. –  alex Apr 8 '10 at 9:28

4 Answers 4

up vote 2 down vote accepted

You can use Labeling Program for Ubuntu.

but if you want something with Terminal, try this

for FAT 12 and 32 Systems, these file systems are most often found on USB thumb drives, flash cards (like for a camera or cell phone), and older external USB hard drives. but may be if your hard disc is FAT 12 or 32 . Thus, check current name in terminal

sudo mlabel -i <device> -s 

for example : sudo mlabel -i /dev/sdb1 ::my_external

if not you edit mtools.conf as sudo

sudo nano /etc/mtools.conf 

add something like for each drive:

   drive p: file="/dev/sdb1"
   drive q: file="/dev/sdb2"

Then use sudo mlabel p:new_label . for example , sudo mlabel p:30GB_FAT32

If your HD is in NTFS ,

first, check the current label sudo ntfslabel <device>

and rename like that sudo ntfslabel <device> <label> Note: 128 characters maximum.

most of linux formatted HD are with ext3, ext4 . thus,

check the lable first sudo e2label <device> and rename sudo e2label <device> <label>. Note: 16 characters maximum.

for more, you should take a look at here.

share|improve this answer
i just do it. thanks it works. –  alex Apr 8 '10 at 9:57

You can change the label of the partition. This is the name usually given to new drives appearing in /media. For this you need to edit the partition table, I would suggest you install gparted with the package manager and us that. Be careful what you do with that tool, it can destroy all your data.

share|improve this answer
thanks. how about how to change UUID? –  alex Apr 8 '10 at 9:28

In Ubuntu 13.04, you can use the native "e2label" from terminal.


  1. list the disks to see which is the one you want to change:

    sudo fdisk -l
  2. change the disk name:

    sudo e2label /dev/sdb1 "mydiskname"
share|improve this answer

For XFS: xfs_admin -L NEWLABEL /dev/sda1

For JFS: jfs_tune /dev/sda2 -L NEWLABEL

For ReiserFS: reiserfstune /dev/sda2 -l NEWLABEL

Partitions must be umounted and has to be executed by root.

share|improve this answer

Your Answer


