github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/daemon/graphdriver/devmapper/README.md (about)

     1  # devicemapper - a storage backend based on Device Mapper
     2  
     3  ## Theory of operation
     4  
     5  The device mapper graphdriver uses the device mapper thin provisioning
     6  module (dm-thinp) to implement CoW snapshots. The preferred model is
     7  to have a thin pool reserved outside of Docker and passed to the
     8  daemon via the `--storage-opt dm.thinpooldev` option. Alternatively,
     9  the device mapper graphdriver can setup a block device to handle this
    10  for you via the `--storage-opt dm.directlvm_device` option.
    11  
    12  As a fallback if no thin pool is provided, loopback files will be
    13  created.  Loopback is very slow, but can be used without any
    14  pre-configuration of storage.  It is strongly recommended that you do
    15  not use loopback in production.  Ensure your Docker daemon has a
    16  `--storage-opt dm.thinpooldev` argument provided.
    17  
    18  In loopback, a thin pool is created at `/var/lib/docker/devicemapper`
    19  (devicemapper graph location) based on two block devices, one for
    20  data and one for metadata. By default these block devices are created
    21  automatically by using loopback mounts of automatically created sparse
    22  files.
    23  
    24  The default loopback files used are
    25  `/var/lib/docker/devicemapper/devicemapper/data` and
    26  `/var/lib/docker/devicemapper/devicemapper/metadata`. Additional metadata
    27  required to map from docker entities to the corresponding devicemapper
    28  volumes is stored in the `/var/lib/docker/devicemapper/devicemapper/json`
    29  file (encoded as Json).
    30  
    31  In order to support multiple devicemapper graphs on a system, the thin
    32  pool will be named something like: `docker-0:33-19478248-pool`, where
    33  the `0:33` part is the minor/major device nr and `19478248` is the
    34  inode number of the `/var/lib/docker/devicemapper` directory.
    35  
    36  On the thin pool, docker automatically creates a base thin device,
    37  called something like `docker-0:33-19478248-base` of a fixed
    38  size. This is automatically formatted with an empty filesystem on
    39  creation. This device is the base of all docker images and
    40  containers. All base images are snapshots of this device and those
    41  images are then in turn used as snapshots for other images and
    42  eventually containers.
    43  
    44  ## Information on `docker info`
    45  
    46  As of docker-1.4.1, `docker info` when using the `devicemapper` storage driver
    47  will display something like:
    48  
    49  	$ sudo docker info
    50  	[...]
    51  	Storage Driver: devicemapper
    52  	 Pool Name: docker-253:1-17538953-pool
    53  	 Pool Blocksize: 65.54 kB
    54  	 Base Device Size: 107.4 GB
    55  	 Data file: /dev/loop4
    56  	 Metadata file: /dev/loop4
    57  	 Data Space Used: 2.536 GB
    58  	 Data Space Total: 107.4 GB
    59  	 Data Space Available: 104.8 GB
    60  	 Metadata Space Used: 7.93 MB
    61  	 Metadata Space Total: 2.147 GB
    62  	 Metadata Space Available: 2.14 GB
    63  	 Udev Sync Supported: true
    64  	 Data loop file: /home/docker/devicemapper/devicemapper/data
    65  	 Metadata loop file: /home/docker/devicemapper/devicemapper/metadata
    66  	 Library Version: 1.02.82-git (2013-10-04)
    67  	[...]
    68  
    69  ### status items
    70  
    71  Each item in the indented section under `Storage Driver: devicemapper` are
    72  status information about the driver.
    73   *  `Pool Name` name of the devicemapper pool for this driver.
    74   *  `Pool Blocksize` tells the blocksize the thin pool was initialized with. This only changes on creation.
    75   *  `Base Device Size` tells the maximum size of a container and image
    76   *  `Data file` blockdevice file used for the devicemapper data
    77   *  `Metadata file` blockdevice file used for the devicemapper metadata
    78   *  `Data Space Used` tells how much of `Data file` is currently used
    79   *  `Data Space Total` tells max size the `Data file`
    80   *  `Data Space Available` tells how much free space there is in the `Data file`. If you are using a loop device this will report the actual space available to the loop device on the underlying filesystem.
    81   *  `Metadata Space Used` tells how much of `Metadata file` is currently used
    82   *  `Metadata Space Total` tells max size the `Metadata file`
    83   *  `Metadata Space Available` tells how much free space there is in the `Metadata file`. If you are using a loop device this will report the actual space available to the loop device on the underlying filesystem.
    84   *  `Udev Sync Supported` tells whether devicemapper is able to sync with Udev. Should be `true`.
    85   *  `Data loop file` file attached to `Data file`, if loopback device is used
    86   *  `Metadata loop file` file attached to `Metadata file`, if loopback device is used
    87   *  `Library Version` from the libdevmapper used
    88  
    89  ## About the devicemapper options
    90  
    91  The devicemapper backend supports some options that you can specify
    92  when starting the docker daemon using the `--storage-opt` flags.
    93  This uses the `dm` prefix and would be used something like `dockerd --storage-opt dm.foo=bar`.
    94  
    95  These options are currently documented both in [the man
    96  page](../../../man/docker.1.md) and in [the online
    97  documentation](https://docs.docker.com/engine/reference/commandline/dockerd/#/storage-driver-options).
    98  If you add an options, update both the `man` page and the documentation.