About this list Date view Thread view Subject view Author view Attachment view

From: Matt Ayres (matta_at_tektonic.net)
Date: Sun 01 Feb 2004 - 19:53:43 GMT


Here is a script I wrote to sync what's in the quota hash to disk. I
also have a another script which is run at boot which reads in the .dlim
files, sets the limits, and calculates the initial usage if a .dlim file
doesn't exist yet. It is highly tied into our database system and
wouldn't be of much use to anyone else though.

Yes, this isn't the cleanest code, but it has worked bug-free for months
on my production servers.

The script is located at http://www.tektonic.net/public/sync_dlim.

On Sun, 2004-02-01 at 14:29, Herbert Poetzl wrote:
> On Sun, Feb 01, 2004 at 02:11:44PM -0500, Gregory (Grisha) Trubetskoy wrote:
> >
> > Let's see...
> >
> > * RedHat 7.3
> > * Kernel 2.4.24 with
> > patch-2.4.24-vs1.24.diff
> > patch-2.4.24-vs1.24-q0.12.diff
> > * Kernel has quota support enabled, VFS v0 quota format disabled
> >
> > * /vserver partition mounted with tagctx:
> > /dev/hda2 on /vservers type ext3 (rw,tagctx)
> >
> > * Create a server using newvserver, set its context id to 5
> >
> > * Using cq-tools-0.06:
> > # ./cqhadd -x 5 -v /dev/hda2
> > adding quota hash for /dev/hda2 ... succeeded.
> >
> > # ./cqdlim -x 5 -S 0,1000,0,5000,10 -v /dev/hda2
> > inodes: 0/1000
> > blocks: 0/5000 (10%)
> >
> > * Start the vserver:
> > # vserver test5 start
> > [...]
> >
> > * # vserver test5 enter
> > ipv4root is now 192.168.1.155
> > New security context is 5
> >
> > [root_at_vserver:test5 /] df -k
> > Filesystem 1k-blocks Used Available Use% Mounted on
> > /dev/hdv1 5000 20 4476 1% /
> >
> > [root_at_vserver:test5 /] dd if=/dev/zero of=blah bs=1024 count=1000
> > 1000+0 records in
> > 1000+0 records out
> >
> > [root_at_vserver:test5 /]df -k
> > Filesystem 1k-blocks Used Available Use% Mounted on
> > /dev/hdv1 5000 1028 3468 23% /
> >
> > So far so good :-)
> >
> > * Now *REBOOT*, then after reboot:
>
> ahh okay, I really should know by now, but I always fall
> for it ... folks always use the term 'context quota', when
> they in fact mean 'context disk limits' ...
>
> okay, for context quota (means that stuff, which is done
> with quotacheck, quotaon, quotaoff and friends) that is
> persistent, because it is stored inside the quota files
> (it might be encessary to update that on vserver start)
>
> the context disk limits are only valid as long as the
> quota hash exists, which obviously doesn't sustain a
> reboot ;)
>
> simple solutions:
>
> a) on every vserver start, scan the directory for file
> sizes and inodes, with du -skx and find, and update
> the 'current' values and set the 'limit' to some
> default ...
>
> b) on server shutdown, store the current and limit values
> in some file (preferable /var/run/vservers/<name>.limit
> and use that values on startup. the vserver tools
> might implement something like this in the near future ...
>
> don't forget to add the quota hash on vserver start and
> remove it again on vserver stop, after all quota/limits
> have been stored ...
>
> HTH,
> Herbert
>
> > # vserver test5 start
> > Starting the virtual server test5
> > [...]
> >
> > # vserver test5 enter
> > ipv4root is now 192.168.1.155
> > New security context is 5
> >
> > [root_at_vserver:test5 /]df -k
> > Filesystem 1k-blocks Used Available Use% Mounted on
> > /dev/hdv1 10078852 371424 9195440 4% /
> >
> >
> > Thanks for all your help, Herbert, I really appreciate it.
> >
> > Grisha
> >
> >
> > On Sat, 31 Jan 2004, Herbert Poetzl wrote:
> >
> > > On Sat, Jan 31, 2004 at 08:36:54AM -0500, Gregory (Grisha) Trubetskoy wrote:
> > > >
> > > > If I follow the intructions on this page
> > > >
> > > > http://vserver.13thfloor.at/Linux2.6/index.php?page=Per+Context+Disk+Limits
> > > >
> > > > ...it works great, but after I reboot, the quota disappears - doesn't seem
> > > > right, I'm probably missing something. Any advice on how to make quota
> > > > persist throughout reboots would be highly appreciated!
> > >
> > > hmm, that should not happen (whatever might happen),
> > >
> > > maybe you could give me a chance, and provide some
> > > details about your setup, and what exactly happens ;)
> > >
> > > TIA,
> > > Herbert
> > >
> > > > Grisha
> > > >
> > > >
> > > > _______________________________________________
> > > > Vserver mailing list
> > > > Vserver_at_list.linux-vserver.org
> > > > http://list.linux-vserver.org/mailman/listinfo/vserver
> > >
> _______________________________________________
> Vserver mailing list
> Vserver_at_list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver

-- 
Matt Ayres <matta_at_tektonic.net>
TekTonic

_______________________________________________ Vserver mailing list Vserver_at_list.linux-vserver.org http://list.linux-vserver.org/mailman/listinfo/vserver


About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Sun 01 Feb 2004 - 19:55:08 GMT by hypermail 2.1.3