Subject: Re: [vserver] Problems with scripts
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Fri, 17 Aug 2007 04:57:32 +0200

On Thu, Aug 16, 2007 at 10:41:49AM -0300, Gustavo wrote:
> On 8/15/07, Herbert Poetzl <herbert@13thfloor.at> wrote:
> >
> > On Wed, Aug 15, 2007 at 05:39:36PM -0300, Gustavo wrote:
> > > Hi, I'm new in list, my name is Gustavo and I've been testing
> > > vservers for some weeks in my work for development and testing,
> > > and made some "helpers" too.
> >
> > > My problem now is with scripts to be located at
> > > /etc/vservers/scripts. As I've seen in the "flower page", they are
> > > initialize, prepre-start, pre-start, post-stop, postpost-stop, and
> > > so on.
> >
> > > Happens that I'm trying to mount a file as a loop device to be
> > > like de block device representing the disk of the vps.
> >
> > not the best decision (performance wise), but works
> > fine (you might want to consider using LVM instead)
> 
> I did, but vserver works natively with the guest filesystem into the
> host filesystem, without any other separation than the context. My
> approach is near lvm but without using it, because I want everything
> in the same partition by now, that's why loop devices. I expect
> performance issues but I'm expermenting; the idea is to have the guest
> filesystem as it was in the host filesystem (the default) but as a
> mount point.
> 
> > Since initialize runs _before_ the fs is mounted, it works fine
> > > but unmounting and freeing the loop dev appears to be not so easy
> > > because maybe there is a chroot to the vps root dir before running
> > > the postpost-stop script.
> >
> > actually you do not need to care about unmounting it,
> > if you mounted it properly (inside the guest namespace)
> > as it will get unmounted when the context disappears
> 
> Not really, it is unmounted but remains on the mount tab on vserver

the mtab should/can be rewritten on guest startup
so that should not be a problem

> stop, and I also need to free the loop device after unmount.
> 
> > Do you know any alternative for doing this?
> >
> > yeah, I would simply put it into the config fstab and
> > be done with it, the tolls will automagically mount it
> > for you and the kernel will take care of unmounting
> 
> would it manage to free the loop?

good point, not sure it will, personally I doubt it
but that could be a simple command in the shutdown
script, just to free up the device

note: you do not have that issue with LVMs :)

HTH,
Herbert

> > (in some days when this finish taking shape, I'll put public the
> > > scripts I made to enhance functionality and make easy common
> > > creation/modification tasks with vservers)
> 
> thanks