How to quickly force-clear the dirty bit on ExFAT filesystem

My ExFAT partition is about 1TB and it takes chkdsk about 10 hours to check and clear the dirty bit flag. There is never an error. It is caused by the drive being disconnected in an unsafe manner (it is being used in a VM and sometimes that gets closed in a manner that is causing this). But I need to have an alternative to the 10 hour wait. I'm going to migrate the data to NTFS as soon as I can to hopefully avoid this problem.


Solution 1:

Basically since exFAT dirty bit is in dec offset 106 of the VBR, and it's a bit, not a byte. Luckily the flags which include byte 106(6a) are not included in the calculation of the VBR checksum. You just use a hex editor to zero that dirty bit. For more detailed info on the layout of the VBR and the lags, the internals are at https://www.sans.org/reading-room/whitepapers/forensics/reverse-engineering-microsoft-exfat-file-system-33274#page=25

And there is also a blog at rshullic.wordpress.com

Solution 2:

Somebody wrote a utility for MacOS to clear the bit (to build run make):

https://github.com/zzh8829/exfat_clean

The repo was found via this post.

And there is also this MacOS-specific question: Disable automatic fsck_exfat on dirty volume mount in Mac OSX with the answer which doesn't seem to work on Mojave.