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

	<entry>
		<id>http://linux-vserver.at/Memory_Limits</id>
		<title>Memory Limits</title>
		<link rel="alternate" type="text/html" href="http://linux-vserver.at/Memory_Limits"/>
				<updated>2010-05-31T13:34:31Z</updated>
		
		<summary type="html">&lt;p&gt;Skaboom: /* Setting memory limits */&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;
'''Beginning with vs2.3.0.36.29 you should use cgroups to set memory limits. More information: [[util-vserver:Cgroups#using_cgroup_to_enforce_memory_limits|using cgroup to enforce memory limits]]'''&lt;br /&gt;
&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>Skaboom</name></author>	</entry>

	<entry>
		<id>http://linux-vserver.at/Standard_non-shared_quota</id>
		<title>Standard non-shared quota</title>
		<link rel="alternate" type="text/html" href="http://linux-vserver.at/Standard_non-shared_quota"/>
				<updated>2009-06-02T11:20:17Z</updated>
		
		<summary type="html">&lt;p&gt;Skaboom: /* Save settings for reboot */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Want to enable quotas from within a vserver, nothing special, just plain old and good quota support? Then this might help you! &lt;br /&gt;
First things first, you will need a vserver enabled kernel that you have made working and you need to add vroot support to it (In menuconfig it is in Device Drivers &amp;amp;rarr; Block Devices &amp;amp;rarr; Virtual Root device support). &lt;br /&gt;
&lt;br /&gt;
After booting on the vroot enabled vserver kernel, you should have a directory '''/dev/vroot/''' with 8 vroot devices (0-7) you can use to set up your quota, if you don't, then you may make them by mknod /dev/vroot/n b 4 n (where n can be from 0 to 7). If your Linux distribution uses ''udev'', these will be at '''/dev/vroot[0-7]''' instead.&lt;br /&gt;
&lt;br /&gt;
== Initial Setup ==&lt;br /&gt;
First, ensure that the filesystem where your vservers are located on the host has quota options enabled: usrquota,grpquota&lt;br /&gt;
&lt;br /&gt;
Edit your /etc/fstab if this is not the case. You don't need to actually enable quotas in the host, but you at least need the usrquota and grpquota mount options.&lt;br /&gt;
&lt;br /&gt;
Then, use ''vrsetup'' to tell the kernel what block device you want to handle quota for:&lt;br /&gt;
 vrsetup /dev/vroot/0 [partition]&lt;br /&gt;
Where [partition] is your /vservers partition. For example, this could be something like /dev/hda5 if you're just using standard partitioning, or something like /dev/lvm/vserver0 if you're using LVM.&lt;br /&gt;
&lt;br /&gt;
== Setting Up Vservers For Quota ==&lt;br /&gt;
Setting up the vserver for quota is straight forward: (you need util-vserver 30.208 or newer)&lt;br /&gt;
&lt;br /&gt;
1. Create a default mtab for the guest. To do this, add:&lt;br /&gt;
 /dev/hdv1 / ufs rw,usrquota,grpquota 0 0&lt;br /&gt;
to '''/etc/vservers/&amp;lt;name&amp;gt;/apps/init/mtab'''&lt;br /&gt;
&lt;br /&gt;
Note: Replace &amp;lt;code&amp;gt;ufs&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;xfs&amp;lt;/code&amp;gt; if you're using an XFS file-system.&lt;br /&gt;
&lt;br /&gt;
2. Add the quota capability to the guest vserver. Add:&lt;br /&gt;
 quota_ctl &lt;br /&gt;
to '''/etc/vservers/&amp;lt;name&amp;gt;/ccapabilities'''&lt;br /&gt;
&lt;br /&gt;
3. Copy the vroot device which we setup earlier to the vserver:&lt;br /&gt;
 cp -af /dev/vroot/0 /vservers/&amp;lt;name&amp;gt;/dev/hdv1&lt;br /&gt;
&lt;br /&gt;
=== Finishing the setup ===&lt;br /&gt;
1. Start your guest.&amp;lt;br /&amp;gt;&lt;br /&gt;
2. Inside the guest, make sure the mtab entry is present:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grep /dev/hdv1 /etc/mtab&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/dev/hdv1 / ufs rw,usrquota,grpquota 0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Afterwards run&lt;br /&gt;
 quotacheck -maugv&lt;br /&gt;
&lt;br /&gt;
3. Still inside the guest, turn quotas on.&lt;br /&gt;
&lt;br /&gt;
=== Save settings for reboot ===&lt;br /&gt;
To have setting persist on reboot, put vrsetup line into '''/etc/init.d/util-vserver''' start function, so after reboot vroot device get setup before it start.&lt;br /&gt;
&lt;br /&gt;
Alternatively add the vrsetup line to the '''/etc/vservers/&amp;lt;vserver-name&amp;gt;/scripts/initialize''' script:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;/usr/sbin/vrsetup /dev/vroot/0 [partition]&amp;quot; &amp;gt;&amp;gt; /etc/vservers/&amp;lt;vserver-name&amp;gt;/scripts/initialize&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the vrsetup detach command into '''/etc/vservers/&amp;lt;vserver-name&amp;gt;/scripts/postpost-stop''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;/usr/sbin/vrsetup -d /dev/vroot/0&amp;quot; &amp;gt;&amp;gt; /etc/vservers/&amp;lt;vserver-name&amp;gt;/scripts/postpost-stop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Skaboom</name></author>	</entry>

	<entry>
		<id>http://linux-vserver.at/Standard_non-shared_quota</id>
		<title>Standard non-shared quota</title>
		<link rel="alternate" type="text/html" href="http://linux-vserver.at/Standard_non-shared_quota"/>
				<updated>2009-06-01T16:32:55Z</updated>
		
		<summary type="html">&lt;p&gt;Skaboom: /* Save settings for reboot */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Want to enable quotas from within a vserver, nothing special, just plain old and good quota support? Then this might help you! &lt;br /&gt;
First things first, you will need a vserver enabled kernel that you have made working and you need to add vroot support to it (In menuconfig it is in Device Drivers &amp;amp;rarr; Block Devices &amp;amp;rarr; Virtual Root device support). &lt;br /&gt;
&lt;br /&gt;
After booting on the vroot enabled vserver kernel, you should have a directory '''/dev/vroot/''' with 8 vroot devices (0-7) you can use to set up your quota, if you don't, then you may make them by mknod /dev/vroot/n b 4 n (where n can be from 0 to 7). If your Linux distribution uses ''udev'', these will be at '''/dev/vroot[0-7]''' instead.&lt;br /&gt;
&lt;br /&gt;
== Initial Setup ==&lt;br /&gt;
First, ensure that the filesystem where your vservers are located on the host has quota options enabled: usrquota,grpquota&lt;br /&gt;
&lt;br /&gt;
Edit your /etc/fstab if this is not the case. You don't need to actually enable quotas in the host, but you at least need the usrquota and grpquota mount options.&lt;br /&gt;
&lt;br /&gt;
Then, use ''vrsetup'' to tell the kernel what block device you want to handle quota for:&lt;br /&gt;
 vrsetup /dev/vroot/0 [partition]&lt;br /&gt;
Where [partition] is your /vservers partition. For example, this could be something like /dev/hda5 if you're just using standard partitioning, or something like /dev/lvm/vserver0 if you're using LVM.&lt;br /&gt;
&lt;br /&gt;
== Setting Up Vservers For Quota ==&lt;br /&gt;
Setting up the vserver for quota is straight forward: (you need util-vserver 30.208 or newer)&lt;br /&gt;
&lt;br /&gt;
1. Create a default mtab for the guest. To do this, add:&lt;br /&gt;
 /dev/hdv1 / ufs rw,usrquota,grpquota 0 0&lt;br /&gt;
to '''/etc/vservers/&amp;lt;name&amp;gt;/apps/init/mtab'''&lt;br /&gt;
&lt;br /&gt;
Note: Replace &amp;lt;code&amp;gt;ufs&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;xfs&amp;lt;/code&amp;gt; if you're using an XFS file-system.&lt;br /&gt;
&lt;br /&gt;
2. Add the quota capability to the guest vserver. Add:&lt;br /&gt;
 quota_ctl &lt;br /&gt;
to '''/etc/vservers/&amp;lt;name&amp;gt;/ccapabilities'''&lt;br /&gt;
&lt;br /&gt;
3. Copy the vroot device which we setup earlier to the vserver:&lt;br /&gt;
 cp -af /dev/vroot/0 /vservers/&amp;lt;name&amp;gt;/dev/hdv1&lt;br /&gt;
&lt;br /&gt;
=== Finishing the setup ===&lt;br /&gt;
1. Start your guest.&amp;lt;br /&amp;gt;&lt;br /&gt;
2. Inside the guest, make sure the mtab entry is present:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grep /dev/hdv1 /etc/mtab&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/dev/hdv1 / ufs rw,usrquota,grpquota 0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Afterwards run&lt;br /&gt;
 quotacheck -maugv&lt;br /&gt;
&lt;br /&gt;
3. Still inside the guest, turn quotas on.&lt;br /&gt;
&lt;br /&gt;
=== Save settings for reboot ===&lt;br /&gt;
To have setting persist on reboot, put vrsetup line into '''/etc/init.d/util-vserver''' start function, so after reboot vroot device get setup before it start.&lt;br /&gt;
&lt;br /&gt;
Alternatively add the vrsetup line to the '''/etc/vservers/&amp;lt;vserver-name&amp;gt;/scripts/initialize''' script:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;vrsetup /dev/vroot/0 [partition]&amp;quot; &amp;gt;&amp;gt; /etc/vservers/&amp;lt;vserver-name&amp;gt;/scripts/initialize&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the vrsetup detach command into '''/etc/vservers/&amp;lt;vserver-name&amp;gt;/scripts/postpost-stop''':&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;vrsetup -d /dev/vroot/0&amp;quot; &amp;gt;&amp;gt; /etc/vservers/&amp;lt;vserver-name&amp;gt;/scripts/postpost-stop&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Skaboom</name></author>	</entry>

	<entry>
		<id>http://linux-vserver.at/Standard_non-shared_quota</id>
		<title>Standard non-shared quota</title>
		<link rel="alternate" type="text/html" href="http://linux-vserver.at/Standard_non-shared_quota"/>
				<updated>2009-06-01T15:46:43Z</updated>
		
		<summary type="html">&lt;p&gt;Skaboom: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Want to enable quotas from within a vserver, nothing special, just plain old and good quota support? Then this might help you! &lt;br /&gt;
First things first, you will need a vserver enabled kernel that you have made working and you need to add vroot support to it (In menuconfig it is in Device Drivers &amp;amp;rarr; Block Devices &amp;amp;rarr; Virtual Root device support). &lt;br /&gt;
&lt;br /&gt;
After booting on the vroot enabled vserver kernel, you should have a directory '''/dev/vroot/''' with 8 vroot devices (0-7) you can use to set up your quota, if you don't, then you may make them by mknod /dev/vroot/n b 4 n (where n can be from 0 to 7). If your Linux distribution uses ''udev'', these will be at '''/dev/vroot[0-7]''' instead.&lt;br /&gt;
&lt;br /&gt;
== Initial Setup ==&lt;br /&gt;
First, ensure that the filesystem where your vservers are located on the host has quota options enabled: usrquota,grpquota&lt;br /&gt;
&lt;br /&gt;
Edit your /etc/fstab if this is not the case. You don't need to actually enable quotas in the host, but you at least need the usrquota and grpquota mount options.&lt;br /&gt;
&lt;br /&gt;
Then, use ''vrsetup'' to tell the kernel what block device you want to handle quota for:&lt;br /&gt;
 vrsetup /dev/vroot/0 [partition]&lt;br /&gt;
Where [partition] is your /vservers partition. For example, this could be something like /dev/hda5 if you're just using standard partitioning, or something like /dev/lvm/vserver0 if you're using LVM.&lt;br /&gt;
&lt;br /&gt;
== Setting Up Vservers For Quota ==&lt;br /&gt;
Setting up the vserver for quota is straight forward: (you need util-vserver 30.208 or newer)&lt;br /&gt;
&lt;br /&gt;
1. Create a default mtab for the guest. To do this, add:&lt;br /&gt;
 /dev/hdv1 / ufs rw,usrquota,grpquota 0 0&lt;br /&gt;
to '''/etc/vservers/&amp;lt;name&amp;gt;/apps/init/mtab'''&lt;br /&gt;
&lt;br /&gt;
Note: Replace &amp;lt;code&amp;gt;ufs&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;xfs&amp;lt;/code&amp;gt; if you're using an XFS file-system.&lt;br /&gt;
&lt;br /&gt;
2. Add the quota capability to the guest vserver. Add:&lt;br /&gt;
 quota_ctl &lt;br /&gt;
to '''/etc/vservers/&amp;lt;name&amp;gt;/ccapabilities'''&lt;br /&gt;
&lt;br /&gt;
3. Copy the vroot device which we setup earlier to the vserver:&lt;br /&gt;
 cp -af /dev/vroot/0 /vservers/&amp;lt;name&amp;gt;/dev/hdv1&lt;br /&gt;
&lt;br /&gt;
=== Finishing the setup ===&lt;br /&gt;
1. Start your guest.&amp;lt;br /&amp;gt;&lt;br /&gt;
2. Inside the guest, make sure the mtab entry is present:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grep /dev/hdv1 /etc/mtab&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/dev/hdv1 / ufs rw,usrquota,grpquota 0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Afterwards run&lt;br /&gt;
 quotacheck -maugv&lt;br /&gt;
&lt;br /&gt;
3. Still inside the guest, turn quotas on.&lt;br /&gt;
&lt;br /&gt;
=== Save settings for reboot ===&lt;br /&gt;
To have setting persist on reboot, put vrsetup line into '''/etc/init.d/util-vserver''' start function, so after reboot vroot device get setup before it start.&lt;/div&gt;</summary>
		<author><name>Skaboom</name></author>	</entry>

	<entry>
		<id>http://linux-vserver.at/Standard_non-shared_quota</id>
		<title>Standard non-shared quota</title>
		<link rel="alternate" type="text/html" href="http://linux-vserver.at/Standard_non-shared_quota"/>
				<updated>2009-06-01T15:45:55Z</updated>
		
		<summary type="html">&lt;p&gt;Skaboom: /* Setting Up Vservers For Quota */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Want to enable quotas from within a vserver, nothing special, just plain old and good quota support? Then this might help you! &lt;br /&gt;
First things first, you will need a vserver enabled kernel that you have made working and you need to add vroot support to it (In menuconfig it is in Device Drivers &amp;amp;rarr; Block Devices &amp;amp;rarr; Virtual Root device support). &lt;br /&gt;
&lt;br /&gt;
After booting on the vroot enabled vserver kernel, you should have a directory '''/dev/vroot/''' with 8 vroot devices (0-7) you can use to set up your quota, if you don't, then you may make them by mknod /dev/vroot/n b 4 n (where n can be from 0 to 7). If your Linux distribution uses ''udev'', these will be at '''/dev/vroot[0-7]''' instead.&lt;br /&gt;
&lt;br /&gt;
== Initial Setup ==&lt;br /&gt;
First, ensure that the filesystem where your vservers are located on the host has quota options enabled: usrquota,grpquota&lt;br /&gt;
&lt;br /&gt;
Edit your /etc/fstab if this is not the case. You don't need to actually enable quotas in the host, but you at least need the usrquota and grpquota mount options.&lt;br /&gt;
&lt;br /&gt;
Then, use ''vrsetup'' to tell the kernel what block device you want to handle quota for:&lt;br /&gt;
 vrsetup /dev/vroot/0 [partition]&lt;br /&gt;
Where [partition] is your /vservers partition. For example, this could be something like /dev/hda5 if you're just using standard partitioning, or something like /dev/lvm/vserver0 if you're using LVM.&lt;br /&gt;
&lt;br /&gt;
== Setting Up Vservers For Quota ==&lt;br /&gt;
Setting up the vserver for quota is straight forward: (you need util-vserver 30.208 or newer)&lt;br /&gt;
&lt;br /&gt;
1. Create a default mtab for the guest. To do this, add:&lt;br /&gt;
 /dev/hdv1 / ufs rw,usrquota,grpquota 0 0&lt;br /&gt;
to '''/etc/vservers/&amp;lt;name&amp;gt;/apps/init/mtab'''&lt;br /&gt;
&lt;br /&gt;
Note: Replace &amp;lt;code&amp;gt;ufs&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;xfs&amp;lt;/code&amp;gt; if you're using an XFS file-system.&lt;br /&gt;
&lt;br /&gt;
2. Add the quota capability to the guest vserver. Add:&lt;br /&gt;
 quota_ctl &lt;br /&gt;
to '''/etc/vservers/&amp;lt;name&amp;gt;/ccapabilities'''&lt;br /&gt;
&lt;br /&gt;
3. Copy the vroot device which we setup earlier to the vserver:&lt;br /&gt;
 cp -af /dev/vroot/0 /vservers/&amp;lt;name&amp;gt;/dev/hdv1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Finishing the setup ===&lt;br /&gt;
&lt;br /&gt;
1. Start your guest.&amp;lt;br /&amp;gt;&lt;br /&gt;
2. Inside the guest, make sure the mtab entry is present:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grep /dev/hdv1 /etc/mtab&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/dev/hdv1 / ufs rw,usrquota,grpquota 0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Afterwards run&lt;br /&gt;
 quotacheck -maugv&lt;br /&gt;
&lt;br /&gt;
3. Still inside the guest, turn quotas on.&lt;br /&gt;
&lt;br /&gt;
=== Save settings for reboot ===&lt;br /&gt;
To have setting persist on reboot, put vrsetup line into '''/etc/init.d/util-vserver''' start function, so after reboot vroot device get setup before it start.&lt;/div&gt;</summary>
		<author><name>Skaboom</name></author>	</entry>

	<entry>
		<id>http://linux-vserver.at/Memory_Limits</id>
		<title>Memory Limits</title>
		<link rel="alternate" type="text/html" href="http://linux-vserver.at/Memory_Limits"/>
				<updated>2008-03-21T17:39:53Z</updated>
		
		<summary type="html">&lt;p&gt;Skaboom: /* Display memory limits within a vserver */&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 each process 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;
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;
== 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 basesystem-vserver -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 of total memory and 12'000 KB 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>Skaboom</name></author>	</entry>

	<entry>
		<id>http://linux-vserver.at/Memory_Limits</id>
		<title>Memory Limits</title>
		<link rel="alternate" type="text/html" href="http://linux-vserver.at/Memory_Limits"/>
				<updated>2008-01-27T13:18:58Z</updated>
		
		<summary type="html">&lt;p&gt;Skaboom: &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 each process 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;
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;
== 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 show as 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; while the remainder will be displayed as swap space.&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>Skaboom</name></author>	</entry>

	</feed>