简体   繁体   English

克隆VM(使用ZFS)后,LXC容器消失了

[英]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. 我在Google云上有一个VM,该VM具有2个磁盘:系统磁盘和ZFS磁盘。 I also have a LXC container (named 'lightapi') on that VM, and everything works. 我在该VM上还有一个LXC容器(名为“ lightapi”),一切正常。 I am using LXC 1.0 (lxc-* commands, without LXD) The LXC is sharing folders with the ZFS disk. 我正在使用LXC 1.0(lxc- *命令,没有LXD)LXC正在与ZFS磁盘共享文件夹。

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. 引导新的VM时,可以在/ var / lib / lxc / lightapi中看到容器文件。 But the container is not running, although in the original VM it was set to autorun on boot. 但是该容器未运行,尽管在原始VM中将其设置为在引导时自动运行。 If I try to lxc-attach, it doesn't work, with no error message. 如果我尝试进行lxc-attach,则无法正常工作,没有错误消息。

It seems that there is something wrong with the ZFS on the new VM: 新虚拟机上的ZFS似乎有问题:

$ zpool list
no pools available

while on the original VM exists a pool. 在原始VM上存在一个池。 I believe that as a result the LXC container is not able to connect. 我相信,结果是LXC容器无法连接。 Is there a way to connect to the zpool that is in the duplicated disk on the new VM? 有没有办法连接到新VM上复制磁盘中的zpool?

I found the answer: 我找到了答案:

Before creating the snapshot, on on the original vm, do : 在创建快照之前,请在原始vm上执行以下操作:

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. 就是这样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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