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:
Martin Vegter
  • 69
  • 66
  • 195
  • 326

3 Answers3

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.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
frostschutz
  • 47,228
  • 5
  • 112
  • 159
1

mtools work:

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

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

drive f: file="/dev/sdb1"
-1

use below command

tune2fs partition_name -U useb_id_what_you_want

use uuidgen to generate random UUID

EightBitTony
  • 20,963
  • 4
  • 61
  • 62
amit singh
  • 420
  • 5
  • 10