Docker Community Forums

Share and learn in the Docker community.

Reconstruct /var/lib/docker from direct LVM Thin pool


(Vikram Khatri) #1

Hi,

Please pardon my ignorance and looking for the answer.

I created direct LVM thin pool using

lsblk --> get device name
cat << EOF > /etc/docker/daemon.json
{
  "storage-opts": [
    "dm.directlvm_device=/dev/sdc",
    "dm.thinp_percent=95",
    "dm.thinp_metapercent=1",
    "dm.thinp_autoextend_threshold=80",
    "dm.thinp_autoextend_percent=20",
    "dm.directlvm_device_force=false",
    "dm.basesize=25G",
    "dm.min_free_space=5%"
  ]
}
EOF

systemctl stop docker
rm -fr /var/lib/docker
systemctl start docker

This was all in a VM. I had a copy of the VM saved before importing more than 100 docker images and the size of the thin pool was around 130 GB after docker load.

Then, I noticed that the size of the os disk (VMDK) size has grown way more than I expected.

I reverted the VM to saved VMDK and then when I try to start Docker, it failed and log message states to remove docker LVM from the disk before starting it.

It looks that I wrongfully thought that all contents were saved in the thin pool but apparently it does not. I should have backed up /var/lib/docker before reverting the VM - which I did not do.

I am ok rebuilding everything again but wondering if there was a way to reconstruct everything from direct LVM disk if /var/lib/docker was gone.

Also - Although another question - how one would backup direct thin pool?

Any thoughts …