[lxc-users] [pepanillo at gmail.com: Managing tarballs in lxd]

Christian Brauner christian.brauner at canonical.com
Mon Apr 24 20:03:32 UTC 2017


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

Date: Mon, 24 Apr 2017 14:04:34 +0200
From: Javier López Sánchez <pepanillo at gmail.com>
To: christian.brauner at 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 -----


More information about the lxc-users mailing list