Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the block size of the iphone filesystem?

Tags:

iphone

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

like image 343
Carl Coryell-Martin Avatar asked Aug 22 '09 06:08

Carl Coryell-Martin


People also ask

What is block size in filesystem?

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.

Does block size affect file size?

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.

How do I choose a file block size?

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.

How do I find the file system on my Iphone?

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.


1 Answers

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
like image 113
Louis Gerbarg Avatar answered Oct 07 '22 14:10

Louis Gerbarg