Changing partition label on Ubuntu

I found this howto from community docs while searching for rename my usb drive. Not many times you need to do this but if you want, here is the summary.

You need few programs depends on the your partition type.
mtools for fat32
ntfsprogs for ntfs
e2label for ext2 or ext3
reiserfstune for reiserfs(v3)
Install which you need by 'sudo aptitude install [program name]'

note : check your partition type by 'mount' or 'df -T'.
For me, my usb is fat32 changing label is done by

pnix@pnix-a7n:~$ sudo mlabel -i /dev/sdb ::myusbdrive
upper command, I just change label to 'myusbdrive'. for other partition types, below are some examples.
sudo ntfslabel /dev/sda1 newlabel
sudo e2label /dev/sda1 newlabel
sudo reiserfstune -l newlabel /dev/sda1

update [many thanks for comment]: for ext2/ext3 you also can use tune2fs like this
sudo tune2fs -L newlabel /dev/sda1

note : may be it's need to umount device before try changing label to get it work.
To get effect for internal drive it's need reboot, for usbdrive I need just unplug/plug.

Change /dev/xxx to match your drive.


Hinken said...

Great! Just what I needed! :)
I checked everywhere but this made it really simple. Just ad how to use fstab and that would be all that I needed at least.

Anonymous said...

For ext2/3(/4 ?) there is also tune2fs.
# tune2fs -L new_lab /dev/sda1