Pages

Friday, September 21, 2012

Modify UUID of A FAT32 or NTFS Partition

The serial number (the 0x43 ~ 0x46 bytes) of FAT32 filesystem is used as UUID in Linux system. You modify UUID of a FAT32 partition by following command:

Dump the first 512 bytes of the FAT32 partition
dd if=/dev/sdb1 of=sblk.bin bs=512 count=1

Modify dump file (e.g. B893-3D6F --> C888-222C)
vi sblk.bin
%!xxd

0000000: eb58 906d 6b64 6f73 6673 0000 0208 2000  .X.mkdosfs.... .
0000010: 0200 0000 00f8 0000 3e00 f900 0000 0000  ........>.......
0000020: 00f8 3f00 f80f 0000 0000 0000 0200 0000  ..?.............
0000030: 0100 0600 0000 0000 0000 0000 0000 0000  ................
0000040: 0000 296f 3d93 b820 2020 2020 2020 2020  ..)o=..        
0000050: 2020 4641 5433 3220 2020 0e1f be77 7cac    FAT32   ...w|.
0000060: 22c0 740b 56b4 0ebb 0700 cd10 5eeb f032  ".t.V.......^..2
0000070: e4cd 16cd 19eb fe54 6869 7320 6973 206e  .......This is n
0000080: 6f74 2061 2062 6f6f 7461 626c 6520 6469  ot a bootable di
0000090: 736b 2e20 2050 6c65 6173 6520 696e 7365  sk.  Please inse
00000a0: 7274 2061 2062 6f6f 7461 626c 6520 666c  rt a bootable fl
00000b0: 6f70 7079 2061 6e64 0d0a 7072 6573 7320  oppy and..press
00000c0: 616e 7920 6b65 7920 746f 2074 7279 2061  any key to try a
00000d0: 6761 696e 202e 2e2e 200d 0a00 0000 0000  gain ... .......
00000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000100: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000110: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000120: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000160: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000170: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000190: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001f0: 0000 0000 0000 0000 0000 0000 0000 55aa  ..............U.

%!xxd -r
x! sblk_m.bin

Write back to the partition
ATTENTION: Make sure that the first 512 bytes of modified file are the same as unmodified. (excepting the serial number)
dd if=sblk_m.bin of=/dev/sdb1 bs=512 count=1
Check UUID of the partition
blkid /dev/sdb1

2 comments: