Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
How to restore a single container from backup zfs snapshot #2286
Comments
AceSlash
commented
Aug 16, 2016
|
On Tue, Aug 16, 2016 at 05:37:49AM -0700, AceSlash wrote:
Why not use
|
AceSlash
commented
Aug 16, 2016
|
@tych0 : Your approach has several issues from my point of view:
Furthermore, I backup the data on the backup host on different site (a mirror backup server and an external encrypted storage) and the backup host is the only one that have access to all the different lxd hosts, some lxd hosts don't see each others (different network, different location). It would be difficult to have the same level of security and check that everything works on 10+ lxd hosts. But your way works if you need HA and quick fail over, and for some containers, I actually replicate the data one more time this way (lxc copy than zfs send/receive to keep it up-to-date), but I purge the history on the lxd hosts very frequently (I only keep 7 days of data on prod servers). |
|
On Tue, Aug 16, 2016 at 08:09:12AM -0700, AceSlash wrote:
True, although you could just
Not necessarily, you can copy just snapshots:
I don't understand these points. Why not just run LXD on the backup
|
AceSlash
commented
Aug 16, 2016
|
From IRC discussion, I see your point: with a backup server running lxd, you can keep up-to-date all the containers from different lxd hosts and if an host dies, you can transfer the container from the backup host to the new lxd host. That's indeed a solution. This is exactly what I meant by:
The main issue is that your backup server must run lxd, which may not be the case (Freebsd, older Linux, etc). While I understand that this may not seem like a big issue, you are basically telling me that lxd containers cannot be saved and restored individually outside a Don't you think that the ability to create/restore a container backup should exist beside this solution? |
|
We talked this over in IRC, but for the record: I think we'd be happy to accept patches that made this possible (e.g. by adding another image type called "zfs" or something, and allowing uploading a zfs blob), but it is not a priority for us right now. |
tych0
referenced this issue
Sep 12, 2016
Closed
How to access containers stored in ZFS on a new host? #2365
nlienard
commented
Oct 18, 2016
•
|
i've also run a freebsd as backup machine and would love to zfs send | ssh backup zfs recv datavols of my containers on this machine. But before; it requires that lxd accept zfs image for restore. |
stgraber
closed this
in
1896416
Nov 28, 2016
givre
commented
Dec 2, 2016
|
Thanks for that guys. |
AceSlash commentedAug 16, 2016
I'll describe my issue so you can better understand the problem.
I have a backup machine, that handle the backup of several lxd hosts. I pull zfs snapshots for critical containers (not necessarily all the containers) from the lxd hosts to the backup server every hour (ssh root@lxdhost1 zfs send -I tank/lxd/container2@2016081615 tank/lxd/container2@2016081615 | zfs receive tank/backup/lxdhost1/lxdhost1/container2/system).
On my backup server, I have something like this as zfs tree:
I also backup the lxd database of all hosts (lxd.db) and the content of the /var/lib/lxd tree (without the mounted zfs devices containing the containers data of course).
If lxdhost1 dies, I need to import container1 to lxdhost2 and container2 to lxdhost3.
To my knowledge, there is no easy way to do that.
For example, to restore the backup of container1 to lxdhost2, I suppose I have to:
lxc inita new container with the same name/config/os on lxdhost2lxc config editto adjust the mac addresses to their old valueszfs destroythe new container datasetzfs send/receivecontainer1 dataset backup to lxdhost2lxc startcontainer1I would like to be able to do something like this instead:
zfs send/receivethe container1 dataset to lxdhost2lxc startcontainer1I'm not sure how to handle the zfs dataset origin (eg: container link to their image). But it should simply be dropped since we just send the zfs dataset without any reference to the original image.
An other way would be to have the backup host as an lxd host and lxc copy every containers to it, then send incremental snapshots to keep the backup up-to-date. This way a simple lxc copy from the backup host to lxdhost2 would work, but you need a backup system with lxd, which is not always possible.
Any more idea how to be able to export/import containers from backup is welcome.