Is it worth it for me to compress a 1000 byte file to a 300 byte file? or will the filesystem space consumption be the same?
I'm looking at storing 10k less than 4k files on my iphone and I'm curious if I'll see space saving by compressing them.
Thank you,
Carl
In a file system, a block is the largest contiguous amount of disk space that can be allocated to a file and also the largest amount of data that can be transferred in a single I/O operation. The block size determines the maximum size of a read request or write request that a file system sends to the I/O device driver.
As blocks become bigger, more files consist of a single block, reducing fragmentation. But because the block is the smallest unit of disk use, very small files still require one whole block, even if most of it remains empty. Having many small files with big blocks wastes space and consumes hard drive capacity quickly.
As a general rule, to increase efficiency, use a larger logical block size for file systems when most of the files are very large. Use a smaller logical block size for file systems when most of the files are very small.
Browse and open files and foldersTap Browse at the bottom of the screen, then tap an item on the Browse screen. If you don't see the Browse screen, tap Browse again. To view recently opened files, tap Recents at the bottom of the screen. To open a file, location, or folder, tap it.
The iPhone uses an HFSX filesystem, with an 8k block size on the user partition:
int main(int argc, char *argv[]) {
struct statfs *mntbufp = NULL;
getmntinfo(&mntbufp, 0);
unsigned i, count = 0;
count = getmntinfo(&mntbufp, 0);
for (i=0; i<count; i++)
{
char *volName = mntbufp[i].f_mntonname;
printf("Volume %s blocksize: %lu\n", volName, mntbufp[i].f_bsize);
}
return 0;
}
returns
Volume / blocksize: 8192 Volume /dev blocksize: 512 Volume /private/var blocksize: 8192 Volume /Developer blocksize: 4096
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With