0

I made an app that requires an SD card to store media. They are small JPGs/GIFs/PNGs, small MP3s... but around 200.000 of them (!!). Very few of them are bigger than a couple MB. Speed is not a concern.

I use a 32GB card (vfat formatted) for this, but it is running out of space. I got a 64GB card which came with HPFS/NTFS/exFAT formatted (according to sfdisk).

What I am facing now is that the 25GB written in the 32GB card occupy +31GB on the 64GB card. So I am loosing lots of space. I guess this is because of the block size or something similar. I faced this before.

So my question is: which would be the best formatting FS/options for my situtation, to use more space on disk, but also taking into account reliability of the FileSystem? I already tried ext3/4 in my device and does not work properly.

4
  • Maybe try something like mkfs.vfat -s 1 - S 512 /dev/sdX1. (I've not tried it, but vfat is very compatible and in theory this should give 512byte sectors rather then the 32k sectors I suspect the default layout has. Say bye bye to performance though)
    – davidgo
    Jan 4, 2019 at 6:57
  • @davidgo: That is what I don't understand. sfdisk reports Sector size (logical/physical): 512 bytes / 512 bytes and I/O size (minimum/optimal): 512 bytes / 512 bytes for both disks. The only difference is FAT32 vs HPFS/NTFS/exFAT. Jan 4, 2019 at 13:41
  • 1
    SFDisk is, I expect, reporting the geometry of the "disk" itself. The filesystem is a mapping/index which defines the number of entries/minimum size of each file on disk. For a 64gig SD card, the default minimum is 128,k - see support.microsoft.com/en-us/help/140365/… as opposed to 32k for vfat. (This also implues my comment was wrong because the minimum practical block size is 32k - so just use "mkfs.vfat /dev/sdX1"
    – davidgo
    Jan 4, 2019 at 18:49
  • You note that 25GB of files is occupying 31GB on the 64GB card, overlooking that the actual files are not the only space required; all file systems require some "overhead" for file name, creation/accessed/modified dates, access permissions, and size, as well as transactional records etc. This overhead is typically in the range of 5-25% of the space. Overview of the different Windows-related file systems is at support.microsoft.com/en-us/help/100108/… . Also deleted files can use space even though they are not readily visible.
    – Debra
    Jan 8, 2019 at 19:35

0

You must log in to answer this question.

Browse other questions tagged .