Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

docker overlayfs & ext4 excessive inode usage #264

Closed
coreos/scripts
#379

Description

@efuquen

I have a coreos vagrant image i'm using locally to run and build docker images on my mac. I'm using the latest CoreOS Alpha channel to test and have run into an issue that I will exhaust inodes on the VM after only half dozen to a dozen docker builds. This seems to be happening far to quickly then it should be. I've made a comment on this docker issue, which looks like it could be related.

I'm not sure if this happens on AWS or this might be related to vagrant specifically. But this bug, whether it's related to docker or CoreOS, will definitely have a big impact on switching over to ext4 from btrfs.

Activity

  1. jmreicha commented on Feb 11, 2015

    @jmreicha

    @efuquen I am running in to a similar issue and I see this behavior in AWS.

    I run docker builds on a machine in AWS. That server is running Ubuntu 14.04, Docker 1.4 and is using the aufs driver. I can post more details if needed.

    I am running these containers on CoreOS hosts with ext4 and the overlayfs driver.

    The Ubuntu server doesn't have any problems with inode usage but the CoreOS machines do, so I suspect the issue is related to overlayfs but I'm not sure what else I can look at to narrow things down.

  2. marineam commented on Feb 12, 2015

    @marineam

    As far as I can tell the gist of the issue is that the overlay driver only uses an overlay mount for containers, it does not use it to stack images together. Instead it copies the entire directory tree for each image, hard-linking files as it goes. So data and inodes of files do not get duplicated but every directory does get duplicated. After a docker build here is a list of inodes per layer vs size reported by docker: (actual disk usage is a bit higher)

    2   0 B
    12830   188.1 MB
    2960    194.5 kB
    2952    1.895 kB
    2951    0 B
    2951    0 B
    12741   221.2 MB
    5407    20.22 MB
    4954    4.999 MB
    4707    0 B
    5107    3.64 MB
    5235    12.77 MB
    4775    0 B
    9599    39.69 MB
    5220    0 B
    5220    0 B
    5452    97.92 MB
    5266    0 B
    5266    0 B
    7294    797 MB
    5637    0 B
    5638    3.497 MB
    6396    15.7 MB
    7489    22.72 MB
    6214    20.21 MB
    6129    2.115 MB
    6128    0 B
    6727    16 MB
    6256    0 B
    6353    1.462 MB
    6284    64 B
    6284    41 B
    6287    1.897 kB
    6297    332 kB
    6284    0 B
    6284    0 B
    6284    0 B
    6948    2.909 MB
    6650    5.811 MB
    6567    3.617 MB
    6509    0 B
    7856    54.81 MB
    
    total inodes: 252390
    total image size reported by docker: 1.535 GB
    total disk usage reported by du: 2.0G
    

    By default mke2fs allocates 1 inode per 16384 bytes but based on the above we actually want something like 8000 bytes per inode. Is that representative? Could folks running into this post the output of df / and df -i / so we can figure out what the bytes-per-inode ratio should be?

  3. marineam commented on Feb 12, 2015

    @marineam

    Went with allocating 1 inode per 4096 bytes, or 1 inode per block which is the maximum. So this should no longer be an issue with machines installed with the next alpha image.

  4. jmreicha commented on Feb 12, 2015

    @jmreicha

    @marineam did you still want stats or should moving to newest alpha take care of this?

  5. marineam commented on Feb 12, 2015

    @marineam

    @jmreicha I am still curious about usage in case we need to adjust this later.

  6. jmreicha commented on Feb 12, 2015

    @jmreicha

    @marineam here is what I come up with.

    sudo df -i /
    Filesystem      Inodes   IUsed IFree IUse% Mounted on
    /dev/xvda9     6368608 6271424 97184   99% /
    
    sudo df -h /
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/xvda9       97G   35G   58G  38% /
    
    docker info
    Containers: 10
    Images: 514
    Storage Driver: overlay
    Execution Driver: native-0.2
    Kernel Version: 3.18.2
    Operating System: CoreOS 571.0.0
    CPUs: 4
    Total Memory: 7.309 GiB
    Name: <redacted>
    ID: 4BEC:UZKT:BCQ6:LYRC:PDNV:4DEH:GTAH:VIOC:74IF:O73M:HEZM:57LY
    Username: <redacted>
    Registry: [https://index.docker.io/v1/]
    

    Let me now if you want any other info.

  7. marineam commented on Feb 12, 2015

    @marineam

    Ok, you are running at about 5998 bytes per inode, so sounds like the 4K value I went with is truly what is required.

  8. jmreicha commented on Feb 12, 2015

    @jmreicha

    Good to know. Do you happen to know which release this change will be available in?

  9. stresler commented on Feb 20, 2015

    @stresler

    localhost core # df /
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/sda9 114791876 27598308 86603868 25% /
    localhost core # df -i /
    Filesystem Inodes IUsed IFree IUse% Mounted on
    /dev/sda9 0 0 0 - /

    seems off - but we have been troubleshooting a bit before we foudn this thread.

  10. lordelph commented on Feb 27, 2015

    @lordelph

    I've been bitten by this also - for what it's worth, my used space/used inodes = 3045 so the proposed fix sounds like it would be appropriate for me. I was running beta but I'll switch to alpha to pick up the changes.

  11. BugRoger commented on May 27, 2015

    @BugRoger

    I'm still being bitten by this every over day on 647.0.0 stable. My ratios are:

    df -i /

    Filesystem      Inodes   IUsed   IFree IUse% Mounted on
    /dev/sda9      2459488 1241252 1218236   51% /
    

    df -h /

    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda9        38G  9.8G   26G  28% /
    

    blocks per inode: 4.0165
    bytes per inode: 16451.6

    Shouldn't this have landed in stable by now?

  12. lamielle commented on May 27, 2015

    @lamielle

    @BugRoger it landed in 591.0.0, so definitely in stable by now. However, if you have upgraded instances from a version before this filesystem formatting tweak then you will have to install a fresh filesystem (full CoreOS install or manually format a new partition). It won't happen "automatically" via upgrades to newer CoreOS versions.

  13. BugRoger commented on May 28, 2015

    @BugRoger

    @lamielle Thanks for the clarification, Alan. That was indeed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions