Sie sind hier

HOWTO change the UUID and or label of a FAT/vfat partition on Linux.

In many forums and wikis the recommended way of changing the uuid of a fat partition involves dd and a hex editor.

However the easy way is to use mtools. Let's suppose we want to change the UUID of a fat partition on /dev/sda1.
As a first step we have a look at the UUIDs of the different file systems:

> blkid
/dev/sda1: SEC_TYPE="msdos" LABEL="boot" UUID="4059-33BB" TYPE="vfat"

This tells us that /dev/sda1 has the UUID 4059-33BB. Not that this number is called “serial number” in the language of FAT systems.

Now we install mtools. For Debian based systems like Ubuntu or raspbian we type
> sudo apt-get install mtools

After installing mtools we have to configure the drive letters. As root you have to edit /etc/mtools.conf.
>sudo nano /etc/mtools.conf

We add the line
drive d: file="/dev/sda1" exclusive
to that file, save and exit the editor. Now, we can check the this line using
> mdir d:

If you get an error message about inconsistencies in the block sizes, you can silence it with the line:
> echo mtools_skip_check=1 > ~/.mtoolsrc

After checking the mdir command again, we can change the serial number of the partition using
> mlabel -n d:

That's it. You can verify your results using the command blkid.

Changing the volume label is an exercise that is left to the reader. As a hint the following commands give you access to the corresponding information:
> mlabel --help
> man mlabel
> info mtools