<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.linux-vserver.at/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.linux-vserver.at/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gl2k10</id>
		<title>Linux-VServer - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.linux-vserver.at/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gl2k10"/>
		<link rel="alternate" type="text/html" href="http://www.linux-vserver.at/Special:Contributions/Gl2k10"/>
		<updated>2026-04-11T06:48:31Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://www.linux-vserver.at/Memory_Limits</id>
		<title>Memory Limits</title>
		<link rel="alternate" type="text/html" href="http://www.linux-vserver.at/Memory_Limits"/>
				<updated>2010-04-25T08:27:33Z</updated>
		
		<summary type="html">&lt;p&gt;Gl2k10: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
A vserver kernel keeps track many resources used by each guest (context). Some of these relate to memory usage by the guest. You can place limits on these resources to prevent guests from using all the host memory and making the host unusable.&lt;br /&gt;
&lt;br /&gt;
Two resources are particularly important in this regard: &lt;br /&gt;
&lt;br /&gt;
* The '''Resident Set Size''' (&amp;lt;code&amp;gt;rss&amp;lt;/code&amp;gt;) is the amount of pages currently present in RAM.&lt;br /&gt;
* The '''Address Space''' (&amp;lt;code&amp;gt;as&amp;lt;/code&amp;gt;) is the total amount of memory (pages) mapped in all the processes in the context.&lt;br /&gt;
&lt;br /&gt;
Both are measured in '''pages''', which are 4 kB each on Intel machines (i386). So a value of 200000 means a limit of 800,000 kB, a little less than 800 MB.&lt;br /&gt;
&lt;br /&gt;
''To easily find out the page size on your host try this line and ignore the warnings''&lt;br /&gt;
&amp;lt;pre&amp;gt;echo 'int main () { printf (&amp;quot;%dKiB\n&amp;quot;, getpagesize ()/1024); return 0; }' | gcc -xc - -o getpagesize &amp;amp;&amp;amp; ./getpagesize&amp;lt;/pre&amp;gt;&lt;br /&gt;
Each resource has a '''soft''' and a '''hard limit'''.&lt;br /&gt;
&lt;br /&gt;
* If a guest exceeds the &amp;lt;code&amp;gt;rss&amp;lt;/code&amp;gt; hard limit, the kernel will invoke the Out-of-Memory (OOM) killer to kill some process in the guest.&lt;br /&gt;
* The &amp;lt;code&amp;gt;rss&amp;lt;/code&amp;gt; soft limit is shown inside the guest as the maximum available memory. If a guest exceeds the &amp;lt;code&amp;gt;rss&amp;lt;/code&amp;gt; soft limit, it will get an extra &amp;quot;bonus&amp;quot; for the OOM killer (proportional to the oversize).&lt;br /&gt;
* If a guest exceeds the &amp;lt;code&amp;gt;as&amp;lt;/code&amp;gt; hard limit, memory allocation attempts will return an error, but no process is killed.&lt;br /&gt;
* The &amp;lt;code&amp;gt;as&amp;lt;/code&amp;gt; soft limit is not in utilized until now. In the future it may be used to penalizing guests over that limit or it could be used to force swapping on them and such ...&lt;br /&gt;
&lt;br /&gt;
Bertl explained the difference between '''rss''' and '''as''' with the following example. If two processes share 100 MB of memory, then only 100 MB worth of virtual memory pages can be used at most, so the RSS use of the guest increases by 100 MB. However, two processes are using it, so the AS use increases by 200 MB. &lt;br /&gt;
&lt;br /&gt;
This makes me think that limiting AS is less useful than limiting RSS, since it doesn't directly reflect real, limited resources (RAM and swap) on the host, that deprive other virtual machines of those resources. Bertl says that AS limits can be used to give guests a &amp;quot;gentle&amp;quot; warning that they are running out of memory, but I don't know how much more gentle it is, or how to set it accurately. &lt;br /&gt;
&lt;br /&gt;
For example, 100 processes each mapping a 100 MB file would consume a total of 10 GB of address space (AS), but no more than 100 MB of resources on the host. But if you set the AS limit to 10 GB, then it will not stop one process from allocating 4 GB of RAM, which could kill the host or result in that process being killed by the OOM killer.&lt;br /&gt;
&lt;br /&gt;
this is posted by siddharth&lt;br /&gt;
&lt;br /&gt;
== Setting memory limits ==&lt;br /&gt;
You can set the hard limit on a particular context, effective immediately, with this command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/sbin/vlimit -c &amp;lt;xid&amp;gt; --&amp;lt;resource&amp;gt; &amp;lt;value&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;xid&amp;gt;&amp;lt;/code&amp;gt; is the context ID of the guest, which you can determine with the &amp;lt;code&amp;gt;/usr/sbin/vserver-stat&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
For example, if you want to change the '''rss''' hard limit for the vserver with &amp;lt;code&amp;gt;&amp;lt;xid&amp;gt;&amp;lt;/code&amp;gt; 49000, and limit it to 10,000 pages (40 MB), you could use this command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/sbin/vlimit -c 49000 --rss 10000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can change the soft limit instead by adding the &amp;lt;code&amp;gt;-S&amp;lt;/code&amp;gt; parameter.&lt;br /&gt;
&lt;br /&gt;
Changes made with the vlimit command are effective only until the vserver is stopped. To make permanent changes, write the value to this file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/etc/vservers/&amp;lt;name&amp;gt;/rlimits/&amp;lt;resource&amp;gt;.hard&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To set a soft limit, use the same file name with the &amp;lt;code&amp;gt;.soft&amp;lt;/code&amp;gt; extension. The &amp;lt;code&amp;gt;rlimits&amp;lt;/code&amp;gt; directory is not created by default, so you may need to create it yourself.&lt;br /&gt;
&lt;br /&gt;
If you omit the suffix after the &amp;lt;code&amp;gt;/etc/vservers/&amp;lt;name&amp;gt;/rlimits/rss&amp;lt;/code&amp;gt; file, the value will be set for both, the hard and soft limit.&lt;br /&gt;
&lt;br /&gt;
Changes to these files take effect only when the vserver is started. To make immediate and permanent changes to a running vserver, you need to run &amp;lt;code&amp;gt;vlimit&amp;lt;/code&amp;gt; '''and''' update the rlimits file.&lt;br /&gt;
&lt;br /&gt;
The safest setting, to prevent any guest from interfering with any other, is to set the total of all RSS hard limits (across all running guests) to be less than the total virtual memory (RAM and swap) on the host. It should be sufficiently less to leave room for processes running on the host, and some disk cache, perhaps 100 MB.&lt;br /&gt;
&lt;br /&gt;
However, this is very conservative, since it assumes the worst case where all guests are using the maximum amount of memory at one time. In practice, you can usually get away with contended resources, i.e. allowing guests to use more than this value.&lt;br /&gt;
&lt;br /&gt;
== Displaying current memory limits ==&lt;br /&gt;
To display the currently active RSS limits for a vserver execute the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vlimit -c &amp;lt;xid&amp;gt; -a -d | grep RSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above command will display a similar result, whereas the third value (5000) is the soft limit and the last reflects the current hard limit (10000).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSS         N/A                  5000             10000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Display memory limits within a vserver ==&lt;br /&gt;
Normally the &amp;lt;code&amp;gt;top&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;free&amp;lt;/code&amp;gt; command will display the RAM and Swap usage of the host while invoked within a vserver. To change this behavior, add the &amp;lt;code&amp;gt;VIRT_MEM&amp;lt;/code&amp;gt; [[Capabilities_and_Flags#Context_flags_.28cflags.29|context flag]] to your vserver configuration:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;VIRT_MEM&amp;quot; &amp;gt;&amp;gt; /etc/vservers/&amp;lt;name&amp;gt;/flags&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After a successful restart of the related vserver, the total available RAM will equal to the value of &amp;lt;code&amp;gt;rss.soft&amp;lt;/code&amp;gt; while the difference of &amp;lt;code&amp;gt;rss.hard&amp;lt;/code&amp;gt; - &amp;lt;code&amp;gt;rss.soft&amp;lt;/code&amp;gt; will be displayed as swap space.&lt;br /&gt;
&lt;br /&gt;
As an example, if you set the &amp;lt;code&amp;gt;rss.hard&amp;lt;/code&amp;gt; limit to 10'000 pages and the &amp;lt;code&amp;gt;rss.soft&amp;lt;/code&amp;gt; limit to 7'000 pages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vlimit -c &amp;lt;xid&amp;gt; --rss 10000&lt;br /&gt;
vlimit -c &amp;lt;xid&amp;gt; -S --rss 7000&lt;br /&gt;
vlimit -c &amp;lt;xid&amp;gt; -a -d | grep RSS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSS         N/A                 7000                10000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;free&amp;lt;/code&amp;gt; will report 28'000 KB (7'000 pages) of total memory and 12'000 KB (10'000 - 7'000 pages) of Swap space (assuming that one page is 4 KB):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
free -k&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
             total       used       free     shared    buffers     cached&lt;br /&gt;
Mem:         28000       4396      23604          0          0          0&lt;br /&gt;
-/+ buffers/cache:       4396      23604&lt;br /&gt;
Swap:        12000          0      12000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:''' According to Herbert, the kernel won't use any ''real'' swap as soon as the &amp;lt;code&amp;gt;rss.soft&amp;lt;/code&amp;gt; limit has been reached. Swapping will be done on the host level, not per vserver (see [http://list.linux-vserver.org/archive?mss:653:200801:iiagcodpghkhehndkgjg &amp;quot;free&amp;quot; command inside vserver]).&lt;/div&gt;</summary>
		<author><name>Gl2k10</name></author>	</entry>

	<entry>
		<id>http://www.linux-vserver.at/User:Gl2k10</id>
		<title>User:Gl2k10</title>
		<link rel="alternate" type="text/html" href="http://www.linux-vserver.at/User:Gl2k10"/>
				<updated>2010-04-22T07:54:23Z</updated>
		
		<summary type="html">&lt;p&gt;Gl2k10: Created page with 'i just started!'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;i just started!&lt;/div&gt;</summary>
		<author><name>Gl2k10</name></author>	</entry>

	<entry>
		<id>http://www.linux-vserver.at/Installation_on_Debian</id>
		<title>Installation on Debian</title>
		<link rel="alternate" type="text/html" href="http://www.linux-vserver.at/Installation_on_Debian"/>
				<updated>2010-04-21T11:25:53Z</updated>
		
		<summary type="html">&lt;p&gt;Gl2k10: /* Install util-vserver by source */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This guide is written against Debian Etch (4.0) and works on Lenny (5.0) as well. Both releases include kernel '''linux-image-vserver-686''', so no manual patching is needed. Hence, Installation on Debian Etch/Lenny is pretty easy and straightforward.&lt;br /&gt;
&lt;br /&gt;
If you need to compile your own kernel, you need to apply the vserver-version.patch. [http://www.kwu.hu/vserver.txt Details at 2007/May/04]&lt;br /&gt;
&lt;br /&gt;
In lenny and etch the tools are for the 2.2 version of vservers, you can find on beng repository packages for the 2.3 version of util-vserver until it is integrated in debian. See &lt;br /&gt;
* [[util-vserver:Devdebianpackage]] - Info about debian v2.3 package from the community&lt;br /&gt;
* explanation on how to use this repository from: http://kernels.bristolwireless.net/   How to use the Debian Repository&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Packages installation ==&lt;br /&gt;
The packages required by Linux-VServer are:&lt;br /&gt;
* '''linux-image-vserver-686''' - This is the current kernel, use '''linux-image-vserver-amd64''' on 64-bit systems, you can still create 32-bit guests&lt;br /&gt;
* '''util-vserver''' - These are the utilities used to administer the guests&lt;br /&gt;
* '''ssh''' - This is probably already installed, but just in case it isn't&lt;br /&gt;
&lt;br /&gt;
All the packages you need can be obtained via&lt;br /&gt;
&amp;lt;pre&amp;gt;aptitude install linux-image-vserver-686 util-vserver ssh&amp;lt;/pre&amp;gt;&lt;br /&gt;
so run this as ''root'' and reboot.&lt;br /&gt;
To check out wherever everything went fine you may run&lt;br /&gt;
&amp;lt;pre&amp;gt;uname -r&amp;lt;/pre&amp;gt;&lt;br /&gt;
and check that kernel version contains '''vserver''', e.g. '''2.6.18-4-vserver-686'''. That's it.&lt;br /&gt;
&lt;br /&gt;
Now that the host system is ready, you can proceed with [[Building Guest Systems|building guests]].&lt;br /&gt;
&lt;br /&gt;
=== Install util-vserver by source ===&lt;br /&gt;
Occasionally, Debian's util-vserver package can be too old. So, we'll need to compile from [http://people.linux-vserver.org/~dhozac/t/uv-testing/ source].&lt;br /&gt;
&lt;br /&gt;
First, install the required packages for util-vserver to compile.&lt;br /&gt;
&amp;lt;pre&amp;gt;apt-get install vlan dietlibc-dev pkg-config libnss3-dev&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, we configure util-vserver&lt;br /&gt;
&amp;lt;pre&amp;gt;./configure --prefix=/usr --enable-release --mandir=/usr/share/man \&lt;br /&gt;
--infodir=/usr/share/info --sysconfdir=/etc --enable-dietlibc \&lt;br /&gt;
--localstatedir=/var --with-vrootdir=/home&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note: You should change ''--with-vrootdir'' accordingly&lt;br /&gt;
&lt;br /&gt;
Finally, we run make to finalise the installation&lt;br /&gt;
&amp;lt;pre&amp;gt;make &amp;amp;&amp;amp; make install install-distribution&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running ''vserver-info'' will show you that the proper util-vserver is installed. :)&lt;br /&gt;
&lt;br /&gt;
Debian likes to be funny, so we need to enable the following,&lt;br /&gt;
* echo /usr/lib/util-vserver/vshelper &amp;gt;| /proc/sys/kernel/vshelper&lt;br /&gt;
* echo kernel.vshelper = /usr/lib/util-vserver/vshelper &amp;gt;&amp;gt; /etc/sysctl.conf&lt;br /&gt;
* update-rc.d vprocunhide defaults&lt;br /&gt;
* update-rc.d vservers-default defaults&lt;br /&gt;
&lt;br /&gt;
== Versions ==&lt;br /&gt;
&lt;br /&gt;
Debian already contains vservers kernels, so no manual patching and compiling is needed. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitablenowrap&amp;quot;&lt;br /&gt;
!Debian release &lt;br /&gt;
!Kernel version&lt;br /&gt;
!VServer version&lt;br /&gt;
|-&lt;br /&gt;
| Etch&lt;br /&gt;
| 2.6.18+6&lt;br /&gt;
| 2.0.2.2-rc9&lt;br /&gt;
|-&lt;br /&gt;
| Lenny&lt;br /&gt;
| 2.6.26+17&lt;br /&gt;
| 2.3.0.35&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unofficial debian vserver packages : http://zbla.net/debian/&lt;br /&gt;
'''WARNING : i386 packets are compiled for 64bits !'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt source line: deb http://zbla.net/debian/ ./&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Issues with the current 2.6.26 Kernel ==&lt;br /&gt;
&lt;br /&gt;
=== Hard CPU scheduling ===&lt;br /&gt;
&lt;br /&gt;
This will not work in the Debian 'Lenny' Kernel, the patch used simply does not contain any of this functionality.&lt;br /&gt;
&lt;br /&gt;
=== Problems due to Xattrs ===&lt;br /&gt;
&lt;br /&gt;
There are two sets of issues within the Lenny kernel caused by the change in value of the Xattrs (extended attributes) applied to file in Vserver setups. The patch used in Debian Lenny uses Xattr flags which are set in positions which differ from the flags set by Debian kernels as well as most of the mainline Vserver patches. This result is that Xattrs of files in a non lenny system appear to have completely different flags in Lenny and vice versa. Since these flags are crucial to vserver hashification and chroot security, they can have devastating effects on Vserver guests and on host system security. If you have recently moved to or away from the stock Lenny Vserver kernel, have look at the symptoms below to see if any match your experiences, and apply the fixes/use another kernel as you see fit.&lt;br /&gt;
&lt;br /&gt;
As of writing these issue has not been corrected within the Debian archive.   These fixes must be applied whenever moving vserver guest '''from''' or '''to''' the Debian 'Lenny's vserver kernel. For more details and a more concise explanation see [http://irc.13thfloor.at/LOG/2009-05/LOG_2009-05-12.txt Bertls IRC explanation ].&lt;br /&gt;
&lt;br /&gt;
==== Chroot Security Problems ====&lt;br /&gt;
&lt;br /&gt;
Linux-Vserver uses file Xattrs to protect guest superusers from being able to view files above their root, preventing access to host file. This creates issues for anyone who:&lt;br /&gt;
&lt;br /&gt;
* has created a guest with a Debian 2.6.26-*-vserver kernel and wishes to use it with another kernel.&lt;br /&gt;
* has created a guest with a different kernel and wishes to use it on a Debian 2.6.26-*-vserver kernel based host.&lt;br /&gt;
&lt;br /&gt;
In effect, the barrier normally in place for guest servers is not recognised by the kernel (the chroot problem) in the situation above and/or immutable links will not function correctly (the unification problem)failing to break when overwritten) in a unified guest setup. Symptoms suffered may include:&lt;br /&gt;
&lt;br /&gt;
* the possibility of vserver guest processes escaping their chroots and accessing other parts of the filesystem&lt;br /&gt;
* guest not starting&lt;br /&gt;
&lt;br /&gt;
To fix the barrier flags for a current kernel, see [[Secure_chroot_Barrier#Solution:_Secure_Barrier | these instructions]]. Note that on some setups a barrier flags will appear on all directories under the guest hierarchy, and need to be unset in order to allow the servers to run. Use showattr to reveal the state of play for your guests and fix appropriately.&lt;br /&gt;
&lt;br /&gt;
==== Unification Problems ====&lt;br /&gt;
&lt;br /&gt;
There is a discrepancy between the immutable-unlink flag used for file unification, the process used in vhashify. This creates considerable issues for anyone who:&lt;br /&gt;
&lt;br /&gt;
* has unified guests with a Debian 2.6.26-*-vserver kernel and wishes to use them with another kernel.&lt;br /&gt;
* has unified guests with a different kernel and wishes to then it on a Debian 2.6.26-*-vserver kernel based host.&lt;br /&gt;
&lt;br /&gt;
Symptoms suffered may include:&lt;br /&gt;
&lt;br /&gt;
* file that cannot be deleted&lt;br /&gt;
* any process involving the writing of files in guests not working&lt;br /&gt;
* files not being unlinked on write&lt;br /&gt;
&lt;br /&gt;
To fix the problem each file must be unlinked then the unification re-applied, or one could try this script submitted to [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508523 bugs.debian.org].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== /proc/mounts issue ===&lt;br /&gt;
&lt;br /&gt;
The vserver's /proc/mounts let appear the vserver path on the host. lsof (for example) is able to print it.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;Ghosts&amp;quot; guests ===&lt;br /&gt;
&lt;br /&gt;
==== Issue ====&lt;br /&gt;
Sometimes a guests loose it's name in vserver-stats and is acting like a zombie. It's impossible to restart or kill it. Stopping all the guests with the util-vserver init.d script doesn't solve the issue. vkill --xid $CTX  doesn't either.&lt;br /&gt;
&lt;br /&gt;
==== Fix ====&lt;br /&gt;
  echo 50 &amp;gt; /var/run/vservers/$vserver&lt;br /&gt;
&lt;br /&gt;
Seems to fix the issue&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Linux-VServer HOWTO by Daniel15: http://howtoforge.com/linux_vserver_debian_etch&lt;/div&gt;</summary>
		<author><name>Gl2k10</name></author>	</entry>

	<entry>
		<id>http://www.linux-vserver.at/Disk_Limits_and_Quota</id>
		<title>Disk Limits and Quota</title>
		<link rel="alternate" type="text/html" href="http://www.linux-vserver.at/Disk_Limits_and_Quota"/>
				<updated>2010-04-21T07:45:36Z</updated>
		
		<summary type="html">&lt;p&gt;Gl2k10: /* Activating disk limits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
We call ''Disk Limit'' a disk space limit in a filesystem for one context (i.e. VServer). If you are interested in using user/group quotas inside a VServer, this is not the right place, look at the [[Quotas]] page.&lt;br /&gt;
&lt;br /&gt;
Of course, you can also use a dedicated partition (or logical volume) for each guest, which is another way to limit disk space usage per guest.&lt;br /&gt;
&lt;br /&gt;
== Activating disk limits ==&lt;br /&gt;
&lt;br /&gt;
For VServer version 2.0, please read http://oldwiki.linux-vserver.org/Disk+Limits&lt;br /&gt;
&lt;br /&gt;
For VServer 2.2+, the procedure is nearly the same, only the mount option has changed:&lt;br /&gt;
&lt;br /&gt;
# Activate the XID tagging on the filesystem hosting the VServer, using the ''tag'' mount option. You cannot use the ''remount'' option to add the tag on an already mounted filesystem. '''Be warn''', it is not advised to use it on the root filesystem! In the next example, we use the &amp;lt;tt&amp;gt;/dev/sdb1&amp;lt;/tt&amp;gt; partition to host all the guests, under the &amp;lt;tt&amp;gt;/vservers&amp;lt;/tt&amp;gt; directory &amp;lt;pre&amp;gt;mount -o tag /dev/sdb1 /vservers&amp;lt;/pre&amp;gt;&lt;br /&gt;
# Consider modifying your &amp;lt;tt&amp;gt;/etc/fstab&amp;lt;/tt&amp;gt; file if necessary, to make the mount option persist across reboots&lt;br /&gt;
# Tag the files belonging to the VServer with its XID &amp;lt;pre&amp;gt;chxid -URx -c vs_name /vservers/vs_name &amp;lt;/pre&amp;gt;&lt;br /&gt;
# Write the limits under the &amp;lt;tt&amp;gt;/etc/vservers/vs_name/dlimits&amp;lt;/tt&amp;gt; directory :&lt;br /&gt;
## Create this directory if necesary&lt;br /&gt;
## Create one sub-directory for each filesystem (in most cases, you should have only one), using any identifier (for example &amp;lt;tt&amp;gt;root&amp;lt;/tt&amp;gt;)&lt;br /&gt;
## Under &amp;lt;tt&amp;gt;/etc/vservers/vs_name/dlimits/root/&amp;lt;/tt&amp;gt; create the following files :&lt;br /&gt;
### &amp;lt;tt&amp;gt;directory&amp;lt;/tt&amp;gt; : contains the directory to which the limit should be applied (for example &amp;lt;tt&amp;gt;/vservers/vs_name&amp;lt;/tt&amp;gt;)&lt;br /&gt;
### &amp;lt;tt&amp;gt;inodes_total&amp;lt;/tt&amp;gt; : the amount of inodes this vserver should be limited to&lt;br /&gt;
### &amp;lt;tt&amp;gt;reserved&amp;lt;/tt&amp;gt; : how much space (percentage-wise) should be reserved for the root user&lt;br /&gt;
### &amp;lt;tt&amp;gt;space_total&amp;lt;/tt&amp;gt; : the amount of space this vserver should be limited to (measured in blocks of 1024 bytes)&lt;br /&gt;
&lt;br /&gt;
== Controling disk limits ==	 &lt;br /&gt;
			&lt;br /&gt;
After starting your VServer, you can control the actual limit using the ''vdlimit'' command (in this example, 300 is the context number associated with ''vs_name'') :	 &lt;br /&gt;
# vdlimit --xid vs_name /vservers	 &lt;br /&gt;
300 /vservers	 &lt;br /&gt;
space_used=154604	 &lt;br /&gt;
space_total=204800	 &lt;br /&gt;
inodes_used=7834	 &lt;br /&gt;
inodes_total=100000	 &lt;br /&gt;
reserved=5	 &lt;br /&gt;
		 &lt;br /&gt;
You can also use the ''vdu'' command to count space or inodes used by a specific guest	 &lt;br /&gt;
# vdu --xid vs_name --space /vservers	 &lt;br /&gt;
/vservers 154604	 &lt;br /&gt;
# vdu --xid vs_name --inodes /vservers	 &lt;br /&gt;
/vservers 7834	 &lt;br /&gt;
		 &lt;br /&gt;
If you just want to update disk usage of a guest activating disk limits, then you can use this script.	 &lt;br /&gt;
It will count the usage of all files and update the limits:	&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
#/bin/sh	 &lt;br /&gt;
_dir=/var/lib/vservers	 &lt;br /&gt;
if [ ! -d $_dir/$1 ]; then	 &lt;br /&gt;
	echo no such vserver	 &lt;br /&gt;
	exit 1;	 &lt;br /&gt;
fi;	 &lt;br /&gt;
chxid -URx -c $1 $_dir/$1	 &lt;br /&gt;
vdlimit --xid $1 -s space_used=$(vdu --xid $1 --space $_dir/$1 | cut -d&amp;quot; &amp;quot; -f2) $_dir/$1	 &lt;br /&gt;
vdlimit --xid $1 -s inodes_used=$(vdu --xid $1 --inode $_dir/$1 | cut -d&amp;quot; &amp;quot; -f2) $_dir/$1	 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
	 &lt;br /&gt;
== Removing disk limits ==	 &lt;br /&gt;
To remove disk limits, remove the &amp;lt;tt&amp;gt;/etc/vservers/vs_name/dlimits/root&amp;lt;/tt&amp;gt; directory '''and''' remove the limits with the following command 	 &lt;br /&gt;
# vdlimit --xid vs_name --remove /vservers&lt;br /&gt;
&lt;br /&gt;
== More information ==&lt;br /&gt;
* See also ''dlimits'' on the util-vserver homepage http://www.nongnu.org/util-vserver/doc/conf/configuration.html&lt;br /&gt;
* For information about limiting diskspace with XFS, please see the [[XFS]] page.&lt;/div&gt;</summary>
		<author><name>Gl2k10</name></author>	</entry>

	<entry>
		<id>http://www.linux-vserver.at/Disk_Limits_and_Quota</id>
		<title>Disk Limits and Quota</title>
		<link rel="alternate" type="text/html" href="http://www.linux-vserver.at/Disk_Limits_and_Quota"/>
				<updated>2010-04-21T07:45:00Z</updated>
		
		<summary type="html">&lt;p&gt;Gl2k10: /* Activating disk limits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
We call ''Disk Limit'' a disk space limit in a filesystem for one context (i.e. VServer). If you are interested in using user/group quotas inside a VServer, this is not the right place, look at the [[Quotas]] page.&lt;br /&gt;
&lt;br /&gt;
Of course, you can also use a dedicated partition (or logical volume) for each guest, which is another way to limit disk space usage per guest.&lt;br /&gt;
&lt;br /&gt;
== Activating disk limits ==&lt;br /&gt;
&lt;br /&gt;
For VServer version 2.0, please read http://oldwiki.linux-vserver.org/Disk+Limits&lt;br /&gt;
&lt;br /&gt;
For VServer 2.2+, the procedure is nearly the same, only the mount option has changed:&lt;br /&gt;
&lt;br /&gt;
# Activate the XID tagging on the filesystem hosting the VServer, using the ''tag'' mount option. You cannot use the ''remount'' option to add the tag on an already mounted filesystem. '''Be warn''', it is not advised to use it on the root filesystem! In the next example, we use the &amp;lt;tt&amp;gt;/dev/sdb1&amp;lt;/tt&amp;gt; partition to host all the guests, under the &amp;lt;tt&amp;gt;/vservers&amp;lt;/tt&amp;gt; directory &amp;lt;pre&amp;gt;mount -o tag /dev/sdb1 /vservers&amp;lt;/pre&amp;gt;&lt;br /&gt;
# Consider modifying your &amp;lt;tt&amp;gt;/etc/fstab&amp;lt;/tt&amp;gt; file if necessary, to make the mount option persist across reboots&lt;br /&gt;
# Tag the files belonging to the VServer with its XID &amp;lt;pre&amp;gt;chxid -URx -c vs_name /vservers/vs_name &amp;lt;/pre&amp;gt;&lt;br /&gt;
# Write the limits under the &amp;lt;tt&amp;gt;/etc/vservers/vs_name/dlimits&amp;lt;/tt&amp;gt; directory :&lt;br /&gt;
## Create this directory if necesary&lt;br /&gt;
## Create one sub-directory for each filesystem (in most cases, you should have only one), using any identifier (for example &amp;lt;tt&amp;gt;root&amp;lt;/tt&amp;gt;)&lt;br /&gt;
## Under &amp;lt;tt&amp;gt;/etc/vservers/vs_name/dlimits/root/&amp;lt;/tt&amp;gt; create the following files :&lt;br /&gt;
### &amp;lt;tt&amp;gt;directory&amp;lt;/tt&amp;gt; : contains the directory to which the limit should be applied (for example /vservers/vs_name)&lt;br /&gt;
### &amp;lt;tt&amp;gt;inodes_total&amp;lt;/tt&amp;gt; : the amount of inodes this vserver should be limited to&lt;br /&gt;
### &amp;lt;tt&amp;gt;reserved&amp;lt;/tt&amp;gt; : how much space (percentage-wise) should be reserved for the root user&lt;br /&gt;
### &amp;lt;tt&amp;gt;space_total&amp;lt;/tt&amp;gt; : the amount of space this vserver should be limited to (measured in blocks of 1024 bytes)&lt;br /&gt;
&lt;br /&gt;
== Controling disk limits ==	 &lt;br /&gt;
			&lt;br /&gt;
After starting your VServer, you can control the actual limit using the ''vdlimit'' command (in this example, 300 is the context number associated with ''vs_name'') :	 &lt;br /&gt;
# vdlimit --xid vs_name /vservers	 &lt;br /&gt;
300 /vservers	 &lt;br /&gt;
space_used=154604	 &lt;br /&gt;
space_total=204800	 &lt;br /&gt;
inodes_used=7834	 &lt;br /&gt;
inodes_total=100000	 &lt;br /&gt;
reserved=5	 &lt;br /&gt;
		 &lt;br /&gt;
You can also use the ''vdu'' command to count space or inodes used by a specific guest	 &lt;br /&gt;
# vdu --xid vs_name --space /vservers	 &lt;br /&gt;
/vservers 154604	 &lt;br /&gt;
# vdu --xid vs_name --inodes /vservers	 &lt;br /&gt;
/vservers 7834	 &lt;br /&gt;
		 &lt;br /&gt;
If you just want to update disk usage of a guest activating disk limits, then you can use this script.	 &lt;br /&gt;
It will count the usage of all files and update the limits:	&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
#/bin/sh	 &lt;br /&gt;
_dir=/var/lib/vservers	 &lt;br /&gt;
if [ ! -d $_dir/$1 ]; then	 &lt;br /&gt;
	echo no such vserver	 &lt;br /&gt;
	exit 1;	 &lt;br /&gt;
fi;	 &lt;br /&gt;
chxid -URx -c $1 $_dir/$1	 &lt;br /&gt;
vdlimit --xid $1 -s space_used=$(vdu --xid $1 --space $_dir/$1 | cut -d&amp;quot; &amp;quot; -f2) $_dir/$1	 &lt;br /&gt;
vdlimit --xid $1 -s inodes_used=$(vdu --xid $1 --inode $_dir/$1 | cut -d&amp;quot; &amp;quot; -f2) $_dir/$1	 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
	 &lt;br /&gt;
== Removing disk limits ==	 &lt;br /&gt;
To remove disk limits, remove the &amp;lt;tt&amp;gt;/etc/vservers/vs_name/dlimits/root&amp;lt;/tt&amp;gt; directory '''and''' remove the limits with the following command 	 &lt;br /&gt;
# vdlimit --xid vs_name --remove /vservers&lt;br /&gt;
&lt;br /&gt;
== More information ==&lt;br /&gt;
* See also ''dlimits'' on the util-vserver homepage http://www.nongnu.org/util-vserver/doc/conf/configuration.html&lt;br /&gt;
* For information about limiting diskspace with XFS, please see the [[XFS]] page.&lt;/div&gt;</summary>
		<author><name>Gl2k10</name></author>	</entry>

	</feed>