4

I have created a FAT16 formatted partition on my USB stick using

mkdosfs /dev/sdb1

when I plug in my stick, it appears in /dev/ as:

/dev/disk/by-uuid/ABCD-1234

How can I change the UUID of the disk to something else than ABCD-1234 ?

UPDATE

tune2fs does not seem to work:

# tune2fs /dev/sdb1 -U AAAA-1111
tune2fs 1.42.5 (29-Jul-2012)
tune2fs: Bad magic number in super-block while trying to open /dev/sdb1
Couldn't find valid filesystem superblock.

UPDATE2

I have installed mtools 4.0.17-1 on Debian Wheezy, but the mlabel command does not work:

# mlabel -N aaaa1111 /dev/sdb1
Mtools version 4.0.17, dated June 29th, 2011
Usage: mlabel [-vscVn] [-N serial] drive:
0

3 Answers 3

4

mtools comes with an utility mlabel which might do the job.

mlabel -N aaaa1111 -i /dev/sdb1 ::

Apart from that you might have to resort to a hex editor. The dosfstools only lets you change the label using the fatlabel command (which mlabel does too, just without the volume id).

If you're willing to re-create the filesystem from scratch, the value can also be supplied via mkfs.vfat -i VOLUME-ID.

4
  • this does not work. Please see my update Feb 10, 2016 at 13:16
  • Oh, and if you add a :? Feb 10, 2016 at 13:20
  • 1
    The correct syntax would be mlabel -N aaaa1111 -i /dev/sdb1 ::, to specify /dev/sdb1 as the "image" to use. Feb 10, 2016 at 13:22
  • This program uses strange DOS drive letter names... mtoolstest might list them. Sorry, I relied too much on the manpage for this one... ;) Feb 10, 2016 at 13:27
1

mtools work:

mlabel -N $(uuidgen | head -c8) f:

You just have to configure /etc/mtools.conf:

drive f: file="/dev/sdb1"
1
  • Why not just mlabel -N $(uuidgen | head -c8) -i /dev/sdb1 ::? Mar 26 at 14:32
-1

use below command

tune2fs partition_name -U useb_id_what_you_want

use uuidgen to generate random UUID

1
  • tune2fs does not work. Please see my update for details. Feb 10, 2016 at 13:00

You must log in to answer this question.

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