Announcement

Collapse
No announcement yet.

[interesting]btrfs and Docker

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [interesting]btrfs and Docker

    Suddenly, I have to come up to speed with Docker for work.
    Originally posted by Docker documentation
    Btrfs is a next generation copy-on-write filesystem that supports many advanced storage technologies that make it a good fit for Docker...
    Docker’s btrfs storage driver leverages many Btrfs features for image and container management. Among these features are block-level operations, thin provisioning, copy-on-write snapshots, and ease of administration.
    Many features indeed. With a single docker container there's 10 subvolumes before I'm even using it. And containers proliferate, chewing through space if one is not careful.
    Regards, John Little

    #2
    Yes, I noticed that, too, but I am not sure if it is as bad as it seems. Doing a du -sch on the docker folder gave me something like 84GB, but I strongly doubt if that is actually what it uses - I don't think I even had that much space to begin with... seems more like <10GB...However, it did prevent me from deleting an old root volume after a restore...

    Comment


      #3
      du does not give meaningful answers on a copy-on-write file system. such as btrfs, if there's any references between subvolumes. For example, on my home desktop's system drive sudo btrfs filesystem usage / says device size 216 GiB, free 60 GiB, but du -hd1 says 1.4T. (du is similarly misled by some other things, like bind mounts, and the squashfs mounts used by snapd.)

      If docker is not on btrfs, it uses its own COW overlayFS, and I imagine du doesn't do well with that either.
      Regards, John Little

      Comment


        #4
        Yes, I suspected that was the case - what would be the best way to estimate the disk usage of something like docker then?

        Comment


          #5
          My usage is:
          ~$ sudo btrfs fi usage /
          [sudo] password for jerry:
          Overall:
          Device size: 441.04GiB
          Device allocated: 170.04GiB
          Device unallocated: 271.00GiB
          Device missing: 0.00B
          Used: 148.06GiB
          Free (estimated): 291.73GiB (min: 291.73GiB)
          Data ratio: 1.00
          Metadata ratio: 1.00
          Global reserve: 286.03MiB (used: 0.00B)

          Data,single: Size:167.01GiB, Used:146.28GiB (87.59%)
          /dev/sda3 167.01GiB

          Metadata,single: Size:3.00GiB, Used:1.79GiB (59.52%)
          /dev/sda3 3.00GiB

          System,single: Size:32.00MiB, Used:48.00KiB (0.15%)
          /dev/sda3 32.00MiB

          Unallocated:
          /dev/sda3 271.00GiB
          My sda is a 500Gb SSD. My usage is 146Gb. However, that does not take into account compression.
          I have a 1 Tb NVMe archive SSD and on it are about a dozen snapshots of my system which, theoretically, is 1.77Tb, yet only 1/3rd of my 1Tb is actually taken. I use the "usage" data to determine the limits of the balance command. The ratio of data size to data used (167/146) is 87%. I set that as my upper limit when I use the "-musate=x and -dusage=x" parameters.

          df gives the same results:
          $ btrfs fi df /
          Data, single: total=167.01GiB, used=146.28GiB
          System, single: total=32.00MiB, used=48.00KiB
          Metadata, single: total=3.00GiB, used=1.79GiB
          GlobalReserve, single: total=286.03MiB, used=0.00B
          "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
          – John F. Kennedy, February 26, 1962.

          Comment


            #6
            Is there a way to get reliable information on a more fine-grained level (like, how much is docker actually using?)

            Comment


              #7
              docker system df should do that, IIUC.
              Regards, John Little

              Comment

              Working...
              X