Results 1 to 10 of 16

Thread: Changing the UUID of a FAT32 or NTFS Partition

Threaded View

  1. #1
    Join Date
    Nov 2006
    Xubuntu Development Release

    Arrow Changing the UUID of a FAT32 or NTFS Partition

    I'm used to finding the answers to all my technical questions with a couple of 'net searches but information in this area seems a bit scarce.

    The typical scenario is that a partition has been backed up using a cloning tool like parted, then various problems appear due to the duplicated UUID. The accepted solution is to alter the volume label on the backup partition using mlabel [mtools] and then edit /etc/fstab to have the backup partition identified using LABEL="WinWhatever" instead of UUID=89C9589FC4162F5. That's not necessarily the end of the story though. A live CD or reinstaller will again trip over the duplicate UUID.

    A more robust solution is to alter the UUID on the backup partition and create a record of the original UUID at the same time, in case the master partition crashes and is unrecoverable. First let's see what we've got:-
    sudo blkid
    Make a note of the partition number X of the backup partition. Use that number instead of X in all the comands below.

    Now let's grab the superblock:-
    sudo dd if=/dev/sdaX of=~/superblockX bs=512 count=1
    And edit it using hexeditor [ncurses-hexedit]:-
    sudo hexeditor ~/superblockX
    The UUID shown by blkid earlier will match the volume serial number which you should see at 0x43-0x46 for VFAT or 0x48-0x4f for NTFS. Change it somehow and save.

    [Optional sanity check: "ls -l ~/superblockX" The file should still be exactly 512 bytes].

    Copy the modified file back to the superblock. I don't need to mention how risky this part is. Be sure you know what you're doing.
    sudo dd if=~/superblockX of=/dev/sdaX bs=512 count=1
    Next edit /etc/fstab with a line identifying the backup partition via its new UUID. You might want to add noauto to the options if you don't want it mounted automatically all the time. Finally, I suggest mounting the backup partition and adding a tag file to its root directory. The file name should indicate the original UUID prior to editing, eg. 540C-0199.vol, as this will be needed if the master partition ever crashes catastrophically or needs to be restored.

    I hope this process will all be automated one day. See this bug report.

    Please post back if you spot errors or if there are just better ways to do the above. I haven't tested this on an NTFS partition yet.

    How FAT32 volume serial numbers are calculated.
    Some info on NTFS.
    Last edited by clubsoda; August 16th, 2009 at 07:00 PM.
    This item has not yet been configured


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts