Package: schroot Version: 0.2.3-2 Severity: wishlist Tags: patch Adeodato Simó <[EMAIL PROTECTED]> writes:
> I mentioned schroot in a channel, and vorlon inquired about the LVM > snapshotting support. I explained that, from what I had learnt, > schroot wanted each chroot in a separate LV, and vorlon suggested what > seemed to me a quite reasonable scheme. > > Summarizing, the suggestion was to allow schroot to specify a path to > the chroot relative to the LV. I include the full conversation below. > > 02:09 <dato> % schroot -a -- sudo apt-get dist-upgrade -yqq > 02:10 <dato> *love* Note that you don't need sudo installed in the chroot. For example, I use schroot (-a|-c $chroot) -u root -- /bin/sh -c 'apt-get update && apt-get -y dist-upgrade' schroot includes (a subset of) the functionality of sudo, so if you use -u root, it will prompt your for a root password, or (if you are in root-groups), give you passwordless root. It's also PAMified, so you can use all the usual PAM stuff. > 02:10 <vorlon> dato: does schroot support LVM snapshots? > 02:11 <dato> vorlon: yes; haven't tried it myself yet, tho > 02:11 <vorlon> dato: I'll probably try it soon, then > 02:11 <vorlon> since xen+multiarch isn't enough to play with on a single > box at one time > 02:11 <vorlon> so I'd better add lvm snapshotting > 02:11 <dato> vorlon: in yesterday's #dd/oftc there was a bit of > discussion about it between me and rleigh and somebody else > 02:12 <dato> vorlon: I was interested in <500mb base chroots (each in > its own LV device, that is), and grow them when snapshotting > 02:12 <vorlon> *growing* them when snapshotting? > 02:13 <dato> vorlon: grow; snaphost; resize_fs; do stuff; throw snapshot > away; shrink > 02:13 <vorlon> I was just going to put all my chroots in a single lv, > and use separate snapshots for each chroot; that avoids, um, growing > filesystems to do snapshots > 02:14 <dato> vorlon: I _believe_ (check with rleigh) that schroot wants > each chroot in one LV. lemme dig backlog > 02:15 <vorlon> dato: oh, poo. > 02:15 <vorlon> dato: my way's more efficient > 02:15 <vorlon> :) > 02:16 <dato> vorlon: yes, seems so. being new to lvm snapshotting, how > much unallocated space you need in that way? > 02:16 <vorlon> dato: you specify the size of the snapshot when you > create it > 02:16 <vorlon> so that sets the max size of the delta you can have in > the particular snapshot > 02:18 <dato> vorlon: oh, really? so if you have e.g. a 600mb base LV, > and 300mb free, you can say -L300mb ? > 02:18 <vorlon> dato: yes > 02:18 <vorlon> dato: if you mean "300 MB free on the VG" > 02:19 <dato> vorlon: yep > 02:24 <dato> vorlon: (in case you're interested, > http://people.debian.org/~adeodato/tmp/2006-02-24//schroot-chitchat; > rleigh seems quite receptive to suggestions, so perhaps it's your > chance to get stuff into schroot :) > 02:27 <vorlon> yeah, I guess grow-then-snapshot could work, but it seems > like a waste of time > 02:29 <dato> what happens if you write to the original LV while you have > your snapshot existing? > 02:29 <dato> a copy is made into the space of the snapshot prior to > overwriting? > 02:29 <vorlon> that becomes part of the delta recorded in the snapshot > 02:29 <vorlon> yes > 02:29 <vorlon> that's the point of a snapshot :) > 02:30 <vorlon> so in theory if you make your snapshot big enough, you > can actually do a chroot upgrade while a build is runing > 02:32 <dato> ok. then it sounds like I want a _small_ LV with 3 or 4 > chroots containing essential+build-essential > 02:32 <dato> and _never_ chroot into there, always create a snapshot > 02:34 <dato> vorlon: I guess you won't mind if I take this conversation > and prepare a mail for rleigh? :) > 02:35 <vorlon> but yeah, if schroot could support specifying a path to > the chroot relative to the lv root dir, that should do it > 02:36 <dato> aye > > 03:21 <dato> vorlon: mmm, wait. > 03:22 <dato> vorlon: I think I'm confused. if I have a 600mb LV with > it's filesystem full, does snapshotting buy me something? > 03:22 <vorlon> uh... it doesn't, no > 03:22 <vorlon> you would have to pre-allocate the space on the base LV > 03:22 <vorlon> unless you want to do the grow/snapshot/resize dance > 03:23 <dato> right, that's what I ended up learning yesterday > 03:23 <dato> and since that's what I wanted to avoid, I guess I'm stuck > (unless I give up) to the funny dance > 03:24 <vorlon> ok This looks like a great idea, and I've implemented it today. I've attached a patch for it (against current CVS). A test tarball is here, which you can build into debs if you like: http://people.debian.org/~rleigh/schroot-0.2.4.tar.bz2 Please could you give it a try, and if you have any comments about it, I'll be happy to make any further amendments. This patch adds a "location" parameter for "block-device" and derived types (like "lvm-snapshot", which is a location inside the filesystem. This required a bit of refactoring of other chroots, including the base class, but if anything it makes things a bit cleaner all round. The documentation is also updated. I've done some testing, and not found any regressions so far. I haven't tested session creation/running/ending, though, just automatic sessions. po/en_GB.po | 117 +++++++++++++++++----------------- po/sv.po | 114 +++++++++++++++++---------------- po/vi.po | 114 +++++++++++++++++---------------- schroot/run/00check | 4 - schroot/run/50sbuild | 14 ++-- schroot/sbuild-chroot-block-device.cc | 20 +++++ schroot/sbuild-chroot-block-device.h | 18 +++++ schroot/sbuild-chroot-config.cc | 2 schroot/sbuild-chroot-plain.cc | 15 ---- schroot/sbuild-chroot-plain.h | 11 --- schroot/sbuild-chroot.cc | 27 +++++++ schroot/sbuild-chroot.h | 35 ++++++++++ schroot/sbuild-session.cc | 10 +- schroot/schroot-setup.5.in | 13 +++ schroot/schroot.conf.5.in | 7 ++ schroot/setup/00check | 12 ++- schroot/setup/10mount | 20 ++--- schroot/setup/20network | 2 schroot/setup/30passwd | 6 - schroot/setup/50chrootname | 2 test/sbuild-chroot-block-device.cc | 1 test/sbuild-chroot-file.cc | 1 test/sbuild-chroot-lvm-snapshot.cc | 1 test/sbuild-chroot-plain.cc | 8 +- test/sbuild-chroot.cc | 1 25 files changed, 349 insertions(+), 226 deletions(-) Regards, Roger -- Roger Leigh Printing on GNU/Linux? http://gutenprint.sourceforge.net/ Debian GNU/Linux http://www.debian.org/ GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
schroot-unify-paths.diff.bz2
Description: Unify path handling for all chroot types
pgprV05ta2PBv.pgp
Description: PGP signature