Changing the backing storage of the standalone lxc

Hello to everyone,

I have been using the lxc for sometime. I have some amount of the container running the production workload on them. My lxc containers are running standalone, i mean i am not using lxd. Now i want to use the zfs as an backing storage of my lxc containers. I have setup the zfs too. Now, Can anyone help me migrating the non zfs container to zfs backed container with minimal downtime or no downtime if possible? I thought i can move the content of the rootfs from the old container to the mounted rootfs of the zfs backed one. But i can see that rootfs for the zfs backed is empty. Is this some error from my side or is it the normal behavior, i am confused at it too. Is there any correct way to solve my issue?

Thank you all.

I’ve not used this in a long long time. But if I was to do it, I’d create a new container using zfs as a backend, then look at zfs list -t all to see exactly what was done, then replicate that for the existing container.

What you’re seeing may be explained by the dataset not being currently mounted.

I can see this behavior when the -B option is provided while lxc-create is initiated. As for the container that are not provided with -B option but lxc.path to zfs, i can see the files and directory in rootfs. Is it i am doing it wrong way? But the problem is while migrating the normal container to zfs backed one. Those that are already in zfs run very good.