简体   繁体   中英

LXC container disappears after cloning a VM (using ZFS)

I have a VM on google cloud that has 2 disks: system disk and a ZFS disk. I also have a LXC container (named 'lightapi') on that VM, and everything works. I am using LXC 1.0 (lxc-* commands, without LXD) The LXC is sharing folders with the ZFS disk.

I wanted to clone the VM, so I stopped it, made snapshots from the disks, and created a new VM using them.

When I boot the new VM, I can see the container files in /var/lib/lxc/lightapi. But the container is not running, although in the original VM it was set to autorun on boot. If I try to lxc-attach, it doesn't work, with no error message.

It seems that there is something wrong with the ZFS on the new VM:

$ zpool list
no pools available

while on the original VM exists a pool. I believe that as a result the LXC container is not able to connect. Is there a way to connect to the zpool that is in the duplicated disk on the new VM?

I found the answer:

Before creating the snapshot, on on the original vm, do :

zpool export [name]

then stop the original vm, duplicate the disk, and clone the vm. After booting the new vm do:

zpool import [name]

And that's it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM