• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..10-Apr-2019-

README.mdH A D10-Apr-20194.8 KiB9983

device_setup.goH A D10-Apr-20196.2 KiB232196

deviceset.goH A D10-Apr-201984.7 KiB2,8252,108

devmapper_doc.goH A D10-Apr-20192.8 KiB1071

devmapper_test.goH A D10-Apr-20196.5 KiB206151

driver.goH A D10-Apr-20197.8 KiB259189

mount.goH A D10-Apr-20191.2 KiB6753

README.md

1# devicemapper - a storage backend based on Device Mapper
2
3## Theory of operation
4
5The device mapper graphdriver uses the device mapper thin provisioning
6module (dm-thinp) to implement CoW snapshots. The preferred model is
7to have a thin pool reserved outside of Docker and passed to the
8daemon via the `--storage-opt dm.thinpooldev` option. Alternatively,
9the device mapper graphdriver can setup a block device to handle this
10for you via the `--storage-opt dm.directlvm_device` option.
11
12As a fallback if no thin pool is provided, loopback files will be
13created.  Loopback is very slow, but can be used without any
14pre-configuration of storage.  It is strongly recommended that you do
15not use loopback in production.  Ensure your Docker daemon has a
16`--storage-opt dm.thinpooldev` argument provided.
17
18In loopback, a thin pool is created at `/var/lib/docker/devicemapper`
19(devicemapper graph location) based on two block devices, one for
20data and one for metadata. By default these block devices are created
21automatically by using loopback mounts of automatically created sparse
22files.
23
24The default loopback files used are
25`/var/lib/docker/devicemapper/devicemapper/data` and
26`/var/lib/docker/devicemapper/devicemapper/metadata`. Additional metadata
27required to map from docker entities to the corresponding devicemapper
28volumes is stored in the `/var/lib/docker/devicemapper/devicemapper/json`
29file (encoded as Json).
30
31In order to support multiple devicemapper graphs on a system, the thin
32pool will be named something like: `docker-0:33-19478248-pool`, where
33the `0:33` part is the minor/major device nr and `19478248` is the
34inode number of the `/var/lib/docker/devicemapper` directory.
35
36On the thin pool, docker automatically creates a base thin device,
37called something like `docker-0:33-19478248-base` of a fixed
38size. This is automatically formatted with an empty filesystem on
39creation. This device is the base of all docker images and
40containers. All base images are snapshots of this device and those
41images are then in turn used as snapshots for other images and
42eventually containers.
43
44## Information on `docker info`
45
46As of docker-1.4.1, `docker info` when using the `devicemapper` storage driver
47will 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
71Each item in the indented section under `Storage Driver: devicemapper` are
72status 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
91The devicemapper backend supports some options that you can specify
92when starting the docker daemon using the `--storage-opt` flags.
93This uses the `dm` prefix and would be used something like `dockerd --storage-opt dm.foo=bar`.
94
95These options are currently documented both in [the man
96page](../../../man/docker.1.md) and in [the online
97documentation](https://docs.docker.com/engine/reference/commandline/dockerd/#/storage-driver-options).
98If you add an options, update both the `man` page and the documentation.
99