docs/daemon/graphdriver/devmapper
Alexander Larsson 7f5ba068f4 devmapper: Add --storage-opt options for basic devicemapper settings
This allows setting these settings to be passed:
dm.basesize
dm.loopdatasize
dm.loopmetadatasize

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-06-05 10:50:07 +02:00
..
MAINTAINERS Add alex as devmapper and btrfs maintainer 2014-05-05 10:47:55 -07:00
README.md devmapper: Add --storage-opt options for basic devicemapper settings 2014-06-05 10:50:07 +02:00
attach_loopback.go devmapper: Remove sys.go mocking framework 2014-05-16 14:12:56 +02:00
deviceset.go devmapper: Add --storage-opt options for basic devicemapper settings 2014-06-05 10:50:07 +02:00
devmapper.go devmapper: Fail init with ErrNotSupported if simple devmapper call fails 2014-06-05 10:42:27 +02:00
devmapper_doc.go Rename runtime/* to daemon/* 2014-04-17 14:43:01 -07:00
devmapper_log.go devmapper: Simplify thin pool device id allocation 2014-04-25 14:26:27 +02:00
devmapper_test.go devicemapper: Remove non-general tests 2014-05-16 12:46:28 +02:00
devmapper_wrapper.go devmapper: Fail init with ErrNotSupported if simple devmapper call fails 2014-06-05 10:42:27 +02:00
driver.go devmapper: Add --storage-opt options for basic devicemapper settings 2014-06-05 10:50:07 +02:00
ioctl.go devmapper: Remove sys.go mocking framework 2014-05-16 14:12:56 +02:00
mount.go devmapper: Remove sys.go mocking framework 2014-05-16 14:12:56 +02:00

README.md

devicemapper - a storage backend based on Device Mapper

Theory of operation

The device mapper graphdriver uses the device mapper thin provisioning module (dm-thinp) to implement CoW snapshots. For each devicemapper graph locaion (typically /var/lib/docker/devicemapper, $graph below) a thin pool is created based on two block devices, one for data and one for metadata. By default these block devices are created automatically by using loopback mounts of automatically creates sparse files.

The default loopback files used are $graph/devicemapper/data and $graph/devicemapper/metadata. Additional metadata required to map from docker entities to the corresponding devicemapper volumes is stored in the $graph/devicemapper/json file (encoded as Json).

In order to support multiple devicemapper graphs on a system the thin pool will be named something like: docker-0:33-19478248-pool, where the 0:30 part is the minor/major device nr and 19478248 is the inode number of the $graph directory.

On the thin pool docker automatically creates a base thin device, called something like docker-0:33-19478248-base of a fixed size. This is automatically formated on creation and contains just an empty filesystem. This device is the base of all docker images and containers. All base images are snapshots of this device and those images are then in turn used as snapshots for other images and eventually containers.

options

The devicemapper backend supports some options that you can specify when starting the docker daemon using the --storage-opt flags. This uses the dm prefix and would be used somthing like docker -d --storage-opt dm.foo=bar.

Here is the list of supported options:

  • dm.basesize

    Specifies the size to use when creating the base device, which limits the size of images and containers. The default value is 10G. Note, thin devices are inherently "sparse", so a 10G device which is mostly empty doesn't use 10 GB of space on the pool. However, the filesystem will use more space for the empty case the larger the device is.

    Example use:

    docker -d --storage-opt dm.basesize=20G

  • dm.loopdatasize

    Specifies the size to use when creating the loopback file for the "data" device which is used for the thin pool. The default size is 100G. Note that the file is sparse, so it will not initially take up this much space.

    Example use:

    docker -d --storage-opt dm.loopdatasize=200G

  • dm.loopmetadatasize

    Specifies the size to use when creating the loopback file for the "metadadata" device which is used for the thin pool. The default size is 2G. Note that the file is sparse, so it will not initially take up this much space.

    Example use:

    docker -d --storage-opt dm.loopmetadatasize=4G