Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dreamer2908/59066658df2844746e5feadba7a589a2 to your computer and use it in GitHub Desktop.
Save dreamer2908/59066658df2844746e5feadba7a589a2 to your computer and use it in GitHub Desktop.
Some ways to change the serial number of exFAT partitions

(Note: limited usefulness, only for some specific uses. Or for fun, because it can be done.)

I want to upgrade the sdcard (32GB in FAT32) in my Android phone to a new 128GB one but I want the mount location to stay the same, i.e /storage/xxxx-xxxx (volume serial number, 8 random hex numbers like 1234-ABCD)

If I format the card, the volume serial number will be randomly generated, so the location changes. Thus, I need to re-allow file access right for some apps, fix some sync jobs, rebuild my music playlists, etc. :effort: I want to keep the serial number as-is.

One option is to clone the partition on the old card to the new one: the serial number will stay the same, and FAT32 does work with 128GB cards. But I don't want FAT32 anymore due to its 4GB file size limit as I want to carry large ISO and movie files. NTFS isn't supported because Lenovo doesn't pay Paragon or Tuxera to get their commercial NTFS drivers. So exFAT is selected.

For FAT32, NTFS, it's easy because there's VolumeID tool from Microsoft Sysinternals (free). https://docs.microsoft.com/en-us/sysinternals/downloads/volumeid

For exFAT, it's not so easy.

The hard way: manually edit the partition header and re-calculate its checksum values. No, definitely not for a lazy fag like me.

The easy way: get AOMEI Partition Assistant Pro or higher edition; it can change the volume serial number of exFAT partitions.

The free version doesn't have this feature. So try Google for either a key for this one-off usage or the bootable ISO. Or better, buy it; it's worth the price.

Paragon Hard Disk Manager 16 Advanced and later also have similar feature.

2019-06-04_221950

The fun way: get KRyLack Volume Serial Number Editor demo CLI version and mod it. I actually did this.

It allows you to change the serial number to 1324-ABCD (the readme says 1234-ABCD, but it's a bit wrong, thank you). exFAT is supported.

Use HxD to search for the string 1324ABCD and replace all instances with the serial you want, i.e 12345678. Actually, only the first one must be replace, but you should do all of them to be sure.

2019-06-04_214455

When you run it, i.e "D:\tmp\volsnsetup\volsn64.exe" c F: 1234-5678, it will change the volume serial number of partition F: to 1234-5678, or whatever you edited above. The console might still says changing to 1324-ABCD if not all 1324ABCD were replaced.

Now you need to physically remove and re-insert the card to see the change.

2019-06-04_224420

Screenshot_20200128-141452_FX od

@Lirabeth
Copy link

Good post. And DiskGenius is also worth mentioning. It has the feauture and it is free

@Noobsai
Copy link

Noobsai commented Feb 9, 2022

Many thanks! The fun way works great!

@Schimmelreiter
Copy link

Excellent!
Was looking for a solution for this for exactly the same reason :)

@likuilin
Copy link

It seems like the KRyLack Volume Serial Number Editor has caught on to this, and the executable now checksums itself on launch. Fortunately, modern tooling has caught up... tune.exfat in exfatprogs can just change the volume serial with the -I flag.

@ChadSimmons
Copy link

@dreamer2908 thanks for the write-up. The KRyLack worked for me on some SDCards, unfortunately not all.

@Lirabeth thanks for the DiskGenius tip, it worked for me when KRyLack wouldn't

@Jakub-KK
Copy link

Jakub-KK commented Nov 4, 2023

I wrote a Windows command-line tool to change the serial number of an exFAT volume - free and open source (MIT License), download latest release of VolumeIdExFAT

@joemck
Copy link

joemck commented Nov 4, 2023

@Jakub-KK Your link is giving me a 404.

@Lirabeth Thanks for recommending DiskGenius. It's way bigger and has way more functions than I need right now, but it let me upgrade my phone's SD without fixing everything I have that points to it, and its other features might come in handy later.

@Jakub-KK
Copy link

Jakub-KK commented Nov 6, 2023

@joemck fixed, thanks - repo was private...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment