Hi All,
I’ve recently decided to heed the warnings about running devicemapper
in loopback
mode, so began investigating direct-lvm
. I can get it up and running OK, but I’m wondering if it’s possible to move the devicemapper
logical volumes from one machine to another without losing the data?
So far when I spin up an EC2 instance and attach a persistent EBS volume and go through the direct-lvm
setup it goes fine, but if I terminate the instance, spin up a new one and attach the same EBS volume docker always wipes the contents of the data
and metadata
logical volumes every time and I lose any containers and images that I had previously created.
Here’s my user-data script to get it all setup
#!/bin/bash
apt-get update && apt-get install -y lvm2
wget -O - https://get.docker.io | bash
service docker stop
rm -rf /var/lib/docker
echo 'DOCKER_OPTS="--storage-driver=devicemapper --storage-opt dm.datadev=/dev/docker/data --storage-opt dm.metadatadev=/dev/docker/metadata"' > /etc/default/docker
lvscan
lvchange -a y /dev/docker/data
lvchange -a y /dev/docker/metadata
service docker start
Here’s the output that docker engine gives when starting up again:
ERRO[0000] devmapper: Device ID 1 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 2 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 3 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 4 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 5 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 6 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 7 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 8 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 9 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 10 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 11 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 12 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 13 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 14 exists in pool but it is supposed to be unused
ERRO[0000] devmapper: Device ID 15 exists in pool but it is supposed to be unused
WARN[0000] devmapper: XFS is not supported in your system. Either the kernel doesnt support it or mkfs.xfs is not in your PATH. Defaulting to ext4 filesystem
INFO[0000] devmapper: Creating filesystem ext4 on device docker-202:1-149365-base
INFO[0005] devmapper: Successfully created filesystem ext4 on device docker-202:1-149365-base
INFO[0005] Graph migration to content-addressability took 0.00 seconds
INFO[0005] Firewalld running: false
INFO[0005] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address
WARN[0005] Your kernel does not support swap memory limit.
INFO[0005] Loading containers: start.
INFO[0005] Loading containers: done.
INFO[0005] Daemon has completed initialization
INFO[0005] Docker daemon commit=c3959b1 execdriver=native-0.2 graphdriver=devicemapper version=1.10.2
INFO[0005] API listen on /var/run/docker.sock
I can see that it’s finding existing IDs
in the volumes, but it just seems to wipe them anyway.
Am I missing something simple, or will devicemapper
always re-initialize the LVMs that it’s using when it starts up?
Thanks,
DD