Search code examples
dockerdiskspacedevice-mapper

Docker aufs and devicemapper directories both exist


I am trying to clean up some space on my server and found that both /var/lib/docker/aufs and /var/lib/docker/devicemapper exist.

  Usage of /:   86.8% of 78.62GB   Users logged in:        0
ncdu 1.10 ~ Use the arrow keys to navigate, press ? for help
--- /var/lib/docker ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                        /..
   35.3GiB [##########] /aufs
   21.4GiB [######    ] /devicemapper
  810.5MiB [          ] /tmp
  188.3MiB [          ] /containers
   96.3MiB [          ] /init
   29.4MiB [          ]  linkgraph.db
   13.4MiB [          ] /graph
    1.2MiB [          ] /execdriver
  108.0KiB [          ] /volumes
   36.0KiB [          ] /vfs
    8.0KiB [          ] /trust
    8.0KiB [          ]  repositories-aufs
    4.0KiB [          ]  repositories-devicemapper

Since it seems like you can have only one enabled at once, I am a bit confused. When I run docker info it looks like I have devicemapper enabled, not aufs:

root@bsc:/var/lib/docker/aufs# docker info
Containers: 115
Images: 326
Storage Driver: devicemapper
 Pool Name: docker-253:1-1318913-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: extfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 15.67 GB
 Data Space Total: 107.4 GB
 Data Space Available: 10.96 GB
 Metadata Space Used: 25.83 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.122 GB
 Udev Sync Supported: false
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.82-git (2013-10-04)
Execution Driver: native-0.2
Kernel Version: 3.13.0-36-generic
Operating System: Ubuntu 14.04.2 LTS
CPUs: 4
Total Memory: 7.798 GiB
Name: bsc
ID: HCND:CWXF:XVRP:OZ45:HDHS:LLNO:Z2T3:L4XZ:UE6N:AOTW:A5C5:PZ76

Does this mean it is safe to delete the /var/lib/docker/devicemapper directory?


Solution

  • It looks like your docker used to use aufs as the storage backend but switched to devicemapper. (probably in result of upgrading the docker package)

    If you (or your package manager) change the storage backend, docker will NOT convert existing containers and/or images to use the new storage backend. Thus, you'll see an empty list of containers and images. But the files will remain there. So it is safe to delete the aufs directory as long as you don't need the containers and images inside it.