TheNewNormal/corectl

Recommend changes to mke2fs example to include more inodes

Closed this issue · 1 comments

Today I ran out of inodes in /var/lib/docker. This apparently a common problem with union file systems such as aufs and overlayfs. Inodes are created aplenty by frequently building and removing many docker images. One solution is to optimize the quantity of available inodes by reducing block size.

With the mke2fs settings currently suggested in the simple usage recipe, when I ran out of inodes the df output was:

core@containerLand ~ $ df -i /var/lib/docker
Filesystem     Inodes  IUsed IFree IUse% Mounted on
/dev/vda       327680 325699  1981  100% /var/lib/docker

I re-created var_lib_docker.img to use 1024 byte blocks and with a 1024 byte inode block size, and now df output is:

core@containerLand ~ $ df -i /var/lib/docker
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
/dev/vda       5242880 268275 4974605    6% /var/lib/docker

That's 16x more inodes. =)

To accomplish this, change the current mke2fs command from this:

  ❯❯❯ /usr/local/Cellar/e2fsprogs/1.42.12/sbin/mke2fs  -t ext4 -m0 -F var_lib_docker.img

To this:

  ❯❯❯ /usr/local/Cellar/e2fsprogs/1.42.12/sbin/mke2fs  -b 1024 -i 1024 -t ext4 -m0 -F var_lib_docker.img

this is now fixed in current head.