7

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?

3
  • Do you mean the path to the device (/dev/sdb1), UUID (550e8400-e29b-11d4...) or the label/name of a partition?
    – Bobby
    Apr 8, 2010 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?
    – Vytas P.
    Apr 8, 2010 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.
    – Vytas P.
    Apr 8, 2010 at 9:28

5 Answers 5

4

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.

0
6

Show Applications -> Disks -> select disk to change name -> setting icon -> edit filesystem -> change -> done

img1

img2

img3

1

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.

0
1

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

Steps:

  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"
    
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .