Fat32 FS Information Sector
Hi,
I have been working on an embedded software application which uses an sd card , and reads the FS Information Sector to identify how much free space is left on the card.
https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system#FS_Information_Sector
Very occasionally , i have found the Free Clusters Value in the FS info sector to be incorrect , after modification with a windows machine.
As i understand it , there are 2 ways for a device to identify how many clusters are free on a fat32 volume , by looking up this sector , or by manually counting every cluster.
It appears as though windows uses both.
Once the fs_info is out of sync , sometimes when deleting a file from the card , it will simply decrement the fs_info by the number of clusters that have been removed by the operation , as if windows is only looking at the fs info.
Other times it will update the fs info to the correct value ,as if it had actually counted the clusters.
Some information as to when the PC trusts the fsinfo file , and when it will re-scan the drive would be appreciated.
It should be noted that the connection between the PC and the SD card is very slow (200-400kbps) , if that changes anything.