Relabel a FAT File System in Linux

The venerable fat16 and fat32 file systems are still in widespread use today. Devices such as digital cameras, satellite navigation systems, memory sticks and mp3 players all make use of FAT

Mount a FAT file system in Linux, and it will appear as something like this:

[root@pluto ~]# df
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/sdb         7716112   7274796    441316  95% /media/0EB5-6037
/dev/sdc1       15549952  14225152   1324800  92% /media/1FC3-3137

Those hex numbers on the left are the default volume labels, and pretty unfriendly they are. The two entries above actually correspond to an MP3 player (Sansa Clip+) and the player’s expansion SD card. I used mlable to allocate more meaningful volume names.

First unmount the drives

[root@pluto ~]# umount /media/0EB5-6037
[root@pluto ~]# umount /media/1FC3-3137

Perform the relabel. Changing the volume name “0EB5-6037” to “SANSACLIP” and “1FC3-3137” (the sd card) to “SANSASD”…

[root@pluto ~]# mlabel -i /dev/sdc1 ::SANSASD
Total number of sectors (31108096) not a multiple of sectors per track (63)!
Add mtools_skip_check=1 to your .mtoolsrc file to skip this test

That didn’t work. Better do as the man says…

[root@pluto ~]# ls ~/.mtoolsrc
ls: cannot access /root/.mtoolsrc: No such file or directory
[root@pluto ~]# echo "mtools_skip_check=1" > ~/.mtoolsrc
[root@pluto ~]# mlabel -i /dev/sdc1 ::SANSASD
[root@pluto ~]# mlabel -i /dev/sdb ::SANSACLIP

After the drives are re-mounted (for example by disconnecting and then reconnecting the player), the new volumes names can be seen:

[root@pluto ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb        7.4G  7.0G  431M  95% /media/SANSACLIP
/dev/sdc1        15G   14G  1.3G  92% /media/SANSASD

Done.

2 thoughts on “Relabel a FAT File System in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.