Sunday, 14 September 2008

Set partition labels on linux.

My colleague Elardus complained that my flash drive didn't have volume labels set and I also wanted automounting to make a nice consistant mountpoint eg. /media/my_flash_drive.
I didn't think think it would be that hard, I really thought that a gui like gparted or qtparted would be able to do that, but was disappointed. So I had to do it from the commandline.

To set the label for ext2 or ext3 partitions:
sudo e2label /dev/sdb2 new_label

where /dev/sdb2 is the partition you want to label. (To get a list of mounted partitions you can do `df -ahT`)


For FAT partitions you first need to configure the drive:
you have to edit /etc/mtools.conf, make f: drive be /dev/sdb1
sudo mlabel f:new_label

Initially I got the following error.
Total number of sectors (256976) not a multiple of sectors per track (63)!
Add mtools_skip_check=1 to your .mtoolsrc file to skip this test
I just did what it asked and then it worked:
echo "mtools_skip_check=1" > ~/.mtoolsrc

I found my info on this page:
http://fedoraforum.org/forum/archive/index.php/t-86378.html

1 comment: