We are using RL-USB and RL-FlashFS and ffree function to check the space availabe on the USB drive. With one 4GB drive with free space of 3.37GB, it reports proper free space ie. 0x0d7fad000 But for another 4GB USB Drive with free space of 767MB, it is reporting free space as 0x12000. We have checked the drive with chkdsk command on windows and there are no errors reported. We would like to know what could be the reason of incorrect free space returned by ffree function.
Note that the image will not become smaller because files are erased.
To shrink the storage requirements, i.e. to allow the image to compress well, the file data and the free space should be filled with constant data. Then a standard file compress program can be used.
The easiest way to normalize the binary patterns of the free space is to create a file as large as possible with constant data. Then erase that file.