containerd/snapshots/devmapper
renzhen.rz 4d11bb36ad devmapper: activate dm device if snap device marked as activated
- reproducer
 1. stop a container;
 2. reboot, or dmsetup remove its corresponding dm device;
 3. start the container, it will fail like:

 """
 Error: failed to start containers: {"message":"failed to create container(4f33d2760760c41518a84821153ccdf7f80980b797b783cdd75178fc6ca0bf4b) on containerd: failed to create task for container(4f33d2760760c41518a84821153ccdf7f80980b797b783cdd75178fc6ca0bf4b): failed to mount rootfs component &{ext4 /dev/mapper/vg0-mythinpool-snap-2 []}: no such file or directory: unknown"}
 """
- how the fix works
 activate the dm device if necessary, and give a warn msg:

 """
 time="2019-08-21T22:44:08.422695797+08:00" level=warning msg="devmapper device \"vg0-mythinpool-snap-2\" marked as \"Activated\" but not active, activating it"
 """

Signed-off-by: Eric Ren <renzhen@linux.alibaba.com>
2019-08-23 10:19:28 +08:00
..
dmsetup snapshots/devmapper: deactivate thin device after committed 2019-05-09 10:58:21 +08:00
losetup devmapper: add linux tags, fix build 2019-02-21 16:26:46 -08:00
config_test.go devmapper: don't create or reload thin-pool from snapshotter 2019-02-21 16:26:46 -08:00
config.go devmapper: don't create or reload thin-pool from snapshotter 2019-02-21 16:26:46 -08:00
device_info.go Better error recovery in devmapper 2019-07-30 15:17:17 -07:00
metadata_test.go Mark faulty devices 2019-08-05 12:05:36 -07:00
metadata.go Mark faulty devices 2019-08-05 12:05:36 -07:00
pool_device_test.go devmapper: activate dm device if snap device marked as activated 2019-08-23 10:19:28 +08:00
pool_device.go devmapper: activate dm device if snap device marked as activated 2019-08-23 10:19:28 +08:00
README.md Update README 2019-02-22 11:10:51 -08:00
snapshotter_test.go devmapper: implement Usage 2019-03-27 14:50:12 -07:00
snapshotter.go snapshots/devmapper: deactivate thin device after committed 2019-05-09 10:58:21 +08:00

Devmapper snapshotter

Devmapper is a containerd snapshotter plugin that stores snapshots in ext4-formatted filesystem images in a devicemapper thin pool.

Setup

To make it work you need to prepare thin-pool in advance and update containerd's configuration file. This file is typically located at /etc/containerd/config.toml.

Here's minimal sample entry that can be made in the configuration file:

[plugins]
  ...
  [plugins.devmapper]
    pool_name = "containerd-pool"
    base_image_size = "128MB"
  ...

The following configuration flags are supported:

  • root_path - a directory where the metadata will be available (if empty default location for containerd plugins will be used)
  • pool_name - a name to use for the devicemapper thin pool. Pool name should be the same as in /dev/mapper/ directory
  • base_image_size - defines how much space to allocate when creating the base device

Pool name and base image size are required snapshotter parameters.

Run

Give it a try with the following commands:

ctr images pull --snapshotter devmapper docker.io/library/hello-world:latest
ctr run --snapshotter devmapper docker.io/library/hello-world:latest test

Requirements

The devicemapper snapshotter requires dmsetup (>= 1.02.110) command line tool to be installed and available on your computer. On Ubuntu, it can be installed with apt-get install dmsetup command.