shrink file size in the FAT table after FatFs f_expand()

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0



I can allocate a contingous space on a sdcard that I write to with a SAME70 µC. So far everything works. I can also shrink the 'displayed' size by using f_truncate(). However if I look into the properties of the sdcard I see that the occupied space is related to the initial size of the f_expand() and is obviously not updated according the f_truncate() call.

So I tried to manually call remove_chain() but that seems to show no effect. I also tried to call f_expand with opt=0 (third parameter that in my understanding should look for a contingous space but not allocate it in the FAT). However this leads only to corrupted data on the sdcard.


Anybody has a hint how to shrink file entries in the FAT after using f_expand()?


Best Regards