We currently migrate to MediaWiki from our old installation, but not all content has been migrated yet. Take a look at the Wiki Team page for instructions how to help or browse through our new wiki at wiki.linux-vserver.org to find the information already migrated.

Context Disk Limits on 2.6 (vs2.0)

This was recommended on IRC to get Disk Quotas working on a per context basis (per vserver). I have tried it and it appears to work. It was also recommended to run this once per reboot, so it could go in the /etc/rc.local file or something. I have put it into /etc/vservers/servername/scripts/poststart, which is where I think it would fit better, but it doesn't seem to be automatically executed when the vserver is started. I need to further investigate this and perhaps submit a bug report. Technically, it would be nice if all this was implemented with the tools...

Syntax:

/usr/sbin/vdlimit --xid <number> --set space_total=<size_in_kilobytes> --set space_used=`du -s /vservers/<vserver_name>/ | awk '{print $1}'` --set inodes_total=<number_of_inodes> --set inodes_used=`ls -1aRi /vservers/<vserver_name>/ | awk '/^[0-9]+ / { print $1 }' | sort -u | wc -l` --set reserved=5 /vservers/<vserver_name>/

Example (setting a vserver called test1 with context 100 to 4 GB):

/usr/sbin/vdlimit --xid 100 --set space_total=4000000 --set space_used=`du -s /vservers/test1/ | awk '{print $1}'` --set inodes_total=4000000 --set inodes_used=`ls -1aRi /vservers/test1/ | awk '/^[0-9]+ / { print $1 }' | sort -u | wc -l` --set reserved=5 /vservers/test1/

This will make it look like the hard drive is actually that size from within the vserver:

Filesystem            Size  Used Avail Use% Mounted on
/dev/hdv1             3.9G  2.2G  1.5G  59% /

Note: If running this on an existing vserver, make sure that the du command's result is not bigger then the limit you are setting. It will return an error and then blow away your / mount, causing major disk space problems! :) See [bug# 14026]