Direct-LVM stops working after reboot

To launch Docker during production, I follow the steps at https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production

Everything seems to be working fine. But if for some reason I reboot, everything will go bad. Even if I delete everything from /var/lib/dockerand I started lvremove, vgremove and pvremove, he still speaks Error starting daemon: error initializing graphdriver: devmapper: Unable to take ownership of thin-pool (docker-thinpool) that already has used data blocksand resists to start.

I know that there should be some kind of documentation that shows how to configure direct lvm settings to reboot. Something automatically restores settings after a reboot. I could not find.

So, how do I get persistence for my direct lvm settings?

+4
source share
2 answers

Fortunately, someone in the Docker community understood the problem and shared their solution. Solution: https://github.com/projectatomic/docker-storage-setup .

apt install -y thin-provisioning-tools
mkdir /usr/lib/docker-storage-setup
mkdir /etc/sysconfig
git clone https://github.com/projectatomic/docker-storage-setup.git     /opt/docker-storage-setup
cp /opt/docker-storage-setup/docker-storage-setup.sh /usr/bin/docker-storage-setup
cp /opt/docker-storage-setup/docker-storage-setup.service /lib/systemd/system/docker-storage-setup.service
cp /opt/docker-storage-setup/libdss.sh /usr/lib/docker-storage-setup
VG=docker DATA_SIZE=95%FREE STORAGE_DRIVER=devicemapper /opt/docker-storage-setup/docker-storage-setup.sh

systemctl enable docker-storage-setup
lvrename docker/thinpool docker/docker-pool

And the related section in the systemd service file in /lib/systemd/system/docker.service needs to be updated as --storage-opt=dm.thinpooldev=/dev/mapper/docker-docker--pool

+2
source

In a bug report, Eric Paris says:

mapper ( loopback)/var/lib/docker , . /var/lib/docker, . Docker , , . - , , /var/lib/docker .

- . rm -rf /var/lib/docker.bk, , .

pvremove -ff /dev/sda2 ( lvm) , lvm, .

, .

, lsblk lvm, ls /dev/mapper. Ubuntu, , (?) . sudo apt-get install thin-provisioning-tools sudo vgchange -ay docker, .

+4

Source: https://habr.com/ru/post/1658368/


All Articles