This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Size of file in file system

Dear all,
After implementing file system on both 1Gb Nand Flash & 4Gb Nand Flash, using LPC1788, i found that the minimum size of any created file was as follows:
1Gb - 8KB
4Gb - 16KB

I want to decrease the file size to 4KB only. If you know any possible way, kindly highlight.
I tried to search for any related document in keil's documentation but could not come across one.
The minimum size of a page in both the Nand Flash is 2KB (incase this data is of any relevance).

Regards,
Dhaval

  • Is it simply that the cluster size is increasing as the disk size increasing?

  • Though it looks like so, have no assurity about this. I haven't come across any document that comments on the minimum size of the created/saved file.

  • What do you actually mean by "minimum size of the created/saved file"? are you suggesting that if you, for example, create a file of 10 bytes, then on reading it back it has been expanded to the minimum value? If you are, then this would clearly be wrong.

    Or are you saying that a 10 byte file is consuming a minimum amount of space on the file system? Which would suggest something akin to a cluster size.

  • Ya. You got it.

    in 1Gb Nand Flash, i created some files to check this. Below are the details:

     Before creating files
    No files...File System Directory...
                                                 120.078.336 bytes free.
    
    
    After creating files 
    File System Directory...
    .                                            <DIR>         01.01.2011  12:00
    ..                                           <DIR>         01.01.2011  12:00
    Android.txt                                          460   01.01.2011  12:00
    Beta.txt                                             430   01.01.2011  12:00
    CupCake.txt                                          460   01.01.2011  12:00
    Donut.txt                                            440   01.01.2011  12:00
    Eclair.txt                                           450   01.01.2011  12:00
    Froyo.txt                                            440   01.01.2011  12:00
    GingerBread.txt                                      500   01.01.2011  12:00
    HoneyComb.txt                                        480   01.01.2011  12:00
    Ice-cream.txt                                        480   01.01.2011  12:00
    JellyBean.txt                                        480   01.01.2011  12:00
                         10 File(s)                    4.620 bytes
                          2 Dir(s)               119.980.032 bytes free.
    

    120.078.336 bytes - 119.980.032 bytes = 96KB
    Total Files + Total directories = 12
    96/12 = 8KB each.
    Even though each file has less number of bytes (460bytes on average), the number of free byte suggests otherwise.
    This is one small experiment. I have also done few more experiments before finally concluding this.

    same goes with 4Gb Nand Flash, each file(/directory) occupies 16KB minimum.

    I also edited the file to store more bytes and found that unless the stored data bytes does not the minimum size, the number of free bytes remains unchanged. And the number of free bytes decrease if the data stored in the file exceeds the minimum size.