lxc-gentoo
lxc-gentoo copied to clipboard
Support LVM2 Snapshots and LVM2 Thin-Provisioned Snapshots as Target
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:
- Configuration complexity (mirror device may be different, requires validation)
- Initial device creation requires zeroing (slower creation)
- The largest size supported is 16GB
Cool features:
- Can use an external read only device as an origin for a thinly-provisioned volume.
Unknowns:
- Not sure if it is possible to create snapshot-of-snapshot beneath a thinly-provisioned volume? Apparently it is possible, due to the phrase "descendants (internal snapshots)" within the documentation.
- How real are speed/storage size benefits over normal dm snapshots? (ie.
lvcreate -n NewLV -s SourceVG/SourceLV
)
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.
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:
- 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.
- 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.
- 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?).
- 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.
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.
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).
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.