Thursday, July 28, 2016

LXC manual migration on ZFS

easy notes to migrate an LXC container to zfs filesystem
I'll use as an example a zfs pool called vd_lxc_container

basically if the <LXC_name> is the non-zfs LXC and <LXC_ZFS> is the zfs version here are the commands to issue:

lxc-stop -n <LXC_name>
mv /var/lib/lxc/<LXC_name> /var/lib/lxc/<LXC_name>_OLD
lxc-copy -B zfs -n <LXC_name>_OLD -N <LXC_ZFS>
zfs list 
in case needed change the mount point and rename the pool:
zfs set mountpoint=/var/lib/lxc/<LXC_damigrare>/rootfs vd_lxc_container/<LXC_ZFS>
zfs rename vd_lxc_container/<LXC_ZFS> vd_lxc_container/<LXC_damigrare>
(zfs list)
Modify config file to match names and mac address in case needed 
lxc-start -n <LXC_ZFS>
lxc-destroy -s -n <LXC_name>_OLD

best Alex 

No comments:

Post a Comment