Moved files under /var/lib to another drive

Hello,

I tried to move the docker files under /var/lib/containerd and /var/lib/docker using mv shell command.
The files were moved and I created the /etc/docker/daemon.json file with the new location of the docker directory.

But apparently subdirectory containerd cannot be moved, at least this way. So docker does not know about my images and containers anymore.

How can I make docker see the files in the new location ?

Thanks,
Regards

This documentation explains how you can change the docker data dir and the containerd data dir:

https://docs.docker.com/engine/daemon/#configure-the-data-directory-location

If you already changed the docker data dir, you still need to move containerd in /etc/containerd/config.toml

version = 2
root = "/mnt/containerd-data"

This is required when the new containerd image store is used, which is the default in newly installed recent Docker versions.

But moving the data dirs that way can also cause problems. Moving images should work, but container filesystem has links that will likely break. You will need to recreate the containers from the images.

I did the change to the config.toml file and it worked.
The I started containerd and then docker and my images and containers are available and start and the apps work.
But I understand the containerd subtree has special block files and symbolic links. But I am not sure if after the change the daemon re-adjusts those.

All I know is that its working.

Thanks,
Regards