Is there an internal algorithm for calculating UUIDs of a flash filesystem? I've been doing some experimenting with a MicroSD card formatted as ExFAT and have come across something that perplexes me.

It seems that my new Android phone mounts the MicroSD card as /storage/[UUID], so for example rather than /mnt/sdcard-ext as I'm used to, it's currently /storage/0CCE-1C48.

Because that's fairly arbitrary, I thought I'd change it to something easier to remember, like 1234-DFDF (my initials in the second half).  I used tune2fs to specify a new UUID, and was able to confirm the change by opening the raw disk in a hex editor.

I actually discovered the UUID is stored at hex offset 0x100064, at least for my particular disk. And because of the Endian-ness, it's stored backwards (so 481CCE0C is parsed by the device as 0CCE-1C48).

Anyway, I was able to verify that it changed to 0xDFDF3412, as it should. I put it in my phone, turned the phone on... voila! It was now /storage/1234-DFDF.

BUT... as soon as I unmounted and remounted the card (or rebooted the phone, etc.) it changed right back to 0CCE-1C48! How can this be? I changed the UUID, replacing the original one with a new one!

This makes me wonder if there's some algorithm built into ExFAT that generates a UUID based on... anything... the partition size, the label, whatever.  The phone is obviously trying to "validate" the serial number and keeps overwriting my custom one with the arbitrary one I was given when I first formatted the disk.
I have no idea how you managed to use tune2fs to change the UUID since it should only be able to manipulate ext2/3/4.

In any case, apparently exFAT have backup boot sector just like FAT(32). So my guess is you only managed to change the UUID in the primary boot sector but not the backup one. So when you unmount it the filesystem driver reverts the change according to the backup boot sector automatically.