----- Forwarded message from Javier López Sánchez <pepani...@gmail.com> -----

Date: Mon, 24 Apr 2017 14:04:34 +0200
From: Javier López Sánchez <pepani...@gmail.com>
To: christian.brau...@ubuntu.com
Subject: Managing tarballs in lxd

Hello Christian, I don't know where to publish this. To help anybody who
need, this is how I make backups and restore my containers on lxd. (Sorry
my horrid English).

Backup

cd /var/lib/lxd/storage-pools/lxd/containers
lxc stop <container_name>
zfs mount lxd/containers/<container_name>
tar --create --verbose --gzip <container_name> --file
<path_to_backup_folder>/<container_name>.tgz
zfs umount lxd/containers/<container_name>
lxc start <container_name>

Restore

After crash, assuming the containers does not exist

cd <temporal_folder>
tar --extract --verbose --file=/<path_to_backup_folder>/<container_name>.tgz
zfs create lxd/containers/<container_name> -o
mountpoint=/var/lib/lxd/storage-pools/lxd/containers/<container_name>
ln -s /var/lib/lxd/storage-pools/lxd/containers/<container_name>
/var/lib/lxd/containers/<container_name>
mv <temporal_folder>
/var/lib/lxd/storage-pools>lxd/containers/<container_name>
lxd import <container_name>
lxc start <container_name>

If version of LXD<2.13 before "lxd import":
mkdir /var/lib/lxd/storage-pools/lxd/snapshots
mkdir /var/lib/lxd/storage-pools/lxd/snapshots/<container_name>

I hope it helps anyone who needs it.

Thanks and best regards

----- End forwarded message -----
_______________________________________________
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Reply via email to