Closed dilshat closed 5 years ago
The output of this research spike should be the technical requirements and a plan as a milestone of issues to implement a facility for Subutai that allows for snapshotting / rolling back containers and dumping differentials between snapshots. Later on we can build on this to implement scheduled backup services for Subutai. These are the primitives to enable the more involved backup service, but for now users should be able to use these primitives via the PeerOS and via the Bazaar to manually back up and restore containers.
To lay the ground, I''ll describe what we use now of zfs:
When a template is imported, the parent templates, containing needed snapshots, must be present (installed) and the delta files are used to bring the template to its actual state by receiving the deltas into the template's datasets
When cloning a container, the parent template's snapshots are cloned into the container's datasets. (The snapshots are installed during template installation)
Filesystem of a container consists of 4 partitions: /root, /var, /opt and /home. Respectively, 4 snapshots are taken during template export along with accompanying configurations files and compressed into a template archive.
For container backups we need to take snapshots of all 4 partitions ( of the 4 corresponding zfs datasets ). The snapshots might reside in the system on zfs itself, or might be exported ( sent ) to a stream or file. Since container also has additional lxc configuration file which effects its operation, we need to include it into a backup too. Thus we arrive to the same approach we have with templates: we take incremental snapshots between parent template and container itself and dump the deltas to an archive with config file included.
Later on we can move this archive to a cloud storage if needed.
Dataset restoration requires the presence of all earlier snapshots in the chain and that the receiving side must be the same as snapshot starting point. This adds complexity for chaining backups. Instead of this, we better use the same approach ( described above ) as with templates and take snapshot between parent template and container current state. Also it depends, whether we want to store backups on the system itself or somewhere else. With the former approach we might not even need to create backup archives since snapshots are stored within zfs itself on the system. With the latter approach, we need to create archives as moveable units.
To restore a container from a backup we can take the following approach:
This is trying to do backups. We just need to expose the ability to take a snapshot on one or more, or all partitions of the container and to do dumps. No need to get complex. We can leave that to higher levels.
We should think what we can do with zfs and how because even simple steps like doing snapshots and dumping to backups need to have a reciprocal operation of restoring container out of these backups. Here low level matters and high not. We need to be able to see the whole picture
Snapshots and rollbacks described https://www.datto.com/au/blog/restoring-data-with-zfs-snapshots
A bit more detailed page http://kbdone.com/zfs-snapshots-clones/
Incremental backup https://blog.fosketts.net/2016/08/18/migrating-data-zfs-send-receive/