globalcitizen / lxc-gentoo

lxc-gentoo: Linux Containers Gentoo Guest Template Script
http://globalcitizen.github.com/lxc-gentoo
GNU General Public License v3.0
85 stars 32 forks source link

Support LVM2 Snapshots and LVM2 Thin-Provisioned Snapshots as Target #42

Open globalcitizen opened 11 years ago

globalcitizen commented 11 years ago

Snapshots I have tested and work, these should be quite easy to roll in.

With regards to the thin provisioning target, my understanding is that is not only experimental but also not really working right yet. The current documentation suggests it also has some drawbacks:

Cool features:

Unknowns:

All things told this is a bit of a project, but useful to get around to. Ideally we can provide some performance testing results with the implementation for reference purposes to validate any meaningful advances for Thin Provisioning over normal snapshots. I am a bit skeptical there will be much different from the separate-LV-per-guest implementation that is possible right now with normal 'dm' snapshots, but we'll see.

PoPoutdoor commented 11 years ago

I am using LVM snapshot for scripted daily backup of some lxc instance.

Not sure what you means about "Thin-Provisioned Snapshots"?

If I get you right, I will do this way:

  1. create a lxc instance as the master copy, which lived in LVM partition. Kill the instance after custom config and passed the brief functional test.
  2. create a snapshot of the master copy(have to rename to something like LXC_S1), copy the master lxc config and renamed to LXC_S1.conf, then start lxc instance and do something on it.
  3. if I needed to test some other things based on LXC_S1, just repeat 2 above and work on the copy as LXC_S2 (snapshot-of-snapshot here?).
  4. If I needed to test something based on an updated master copy, just start the master lxc instance, do an emerge -uDN world and jump to step 2 above for my test.

If you have the latest TB drive, just create the lvm partitions with date-code.version and create as many snapshots as you like. The only rule will be mount as needed, run lxc instance as needed to prevent host running out of ram.

globalcitizen commented 11 years ago

Thin provisioning docs @ https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/device-mapper/thin-provisioning.txt?id=refs/tags/v3.9-rc3

LVM snapshots' issue is that you can't do snapshot-of-a-snapshot yet. Right now I have them tested and working but are not part of lxc-gentoo yet.

specing commented 11 years ago

I don't think LVM is suited for a workload such as LXC and people should use a proper deduplicating filesystem instead (such as btrfs with offline bedup dedupe (me) or ZFS).

globalcitizen commented 11 years ago

There are many use cases... btrfs and zfs may not be suitable for everyone. LVM snapshots are present on many systems and despite their drawbacks are therefore a reasonable tool to consider integrating with.