<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  
  
  <channel>
    <title>chrisjrob: openvz</title>
    <link>https://chrisjrob.com</link>
    <atom:link href="https://chrisjrob.com/tag/openvz/feed/index.xml" rel="self" type="application/rss+xml" />
    <description>GNU Linux, Perl and FLOSS</description>
    <language>en-gb</language>
    <pubDate>Fri, 13 Feb 2026 17:22:31 +0000</pubDate>
    <lastBuildDate>Fri, 13 Feb 2026 17:22:31 +0000</lastBuildDate>
    
    <item>
      <title>Howto | OpenVZ Notes</title>
      <link>https://chrisjrob.com/2010/10/05/openvz-notes/</link>
      <pubDate>Tue, 05 Oct 2010 13:09:30 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2010/10/05/openvz-notes</guid>
      <description>
       <![CDATA[
         
         <h2 id="warning">Warning</h2>

<p>This is just an aide-memoire, please don’t try and follow it.</p>

<h2 id="creating-a-template">Creating a template</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># rm -f /etc/ssh/ssh_host_*
cat &lt;&lt; EOF &gt; /etc/rc2.d/S15ssh_gen_host_keys
#!/bin/bash
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''
rm -f \$0
EOF
# chmod a+x /etc/rc2.d/S15ssh_gen_host_keys
</code></pre></div></div>

<!--more-->

<h2 id="tip-re-freenx-server">Tip re. freenx-server</h2>

<p>You will need to reconfigure the freenx-server:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo dpkg-reconfigure freenx-server
</code></pre></div></div>

<h2 id="updating-template">Updating template</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo vzctl enter XXX
$ sudo apt-get clean
$ exit
$ sudo vzctl set XXX --ipdel all --save
$ sudo vim /var/lib/vz/private/XXX/etc/resolv.conf
$ sudo rm -f /var/lib/vz/private/XXX/etc/hostname
$ sudo vzctl stop XXX
$ cd /var/lib/vz/private/XXX
$ tar --numeric-owner -zcf /var/lib/vz/template/cache/debian-5.0-i386-minimal.tar.gz .
</code></pre></div></div>

<h2 id="create-configuration-template-for-10-vms">Create configuration template for 10 vms</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo vzsplit -n 10 -f vps.tenth
</code></pre></div></div>

<h2 id="create-new-vm">Create new vm</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo vzctl create XXX --ostemplate debian-5.0-i386-minimal --config vps.basic
sudo vzctl create XXX --ostemplate debian-5.0-i386-kde --config vps.tenth
sudo vzctl start XXX
sudo vzctl set XXX --ipadd 192.168.0.XXX --save
sudo vzctl set XXX --nameserver 192.168.0.254 --save
sudo vzctl set XXX --onboot yes --save
sudo vzctl set XXX --hostname server-XXXXXX.example.co.uk --save
sudo vzctl set XXX --diskspace $(( 1048576*2 )):$(( 1153434*2 )) --save
sudo vzctl set XXX --diskspace 10G:11G --save
vzcfgvalidate /etc/vz/conf/XXX.conf
</code></pre></div></div>

<h2 id="other-tricks">Other tricks</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo vzctl start XXX
sudo vzctl exec XXX passwd
sudo vzctl exec XXX ps aux
sudo vzctl enter XXX
sudo vzctl stop XXX
</code></pre></div></div>

<h2 id="removing-a-vm">Removing a vm</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo vzctl destroy XXX
$ sudo rm /etc/vz/conf/XXX.conf.destroyed
</code></pre></div></div>

<h2 id="list-running-and-non-running">List running and non-running</h2>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo vzlist -a
</code></pre></div></div>

<h2 id="memory-use">Memory use</h2>

<h3 id="check-memory-usage-for-guest-103">Check memory usage for guest 103</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo vzcalc -v 103
</code></pre></div></div>

<h3 id="set-minimum-memory-256-x-memory-wanted">Set minimum memory 256 x memory wanted</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo vzctl set vpsid --vmguarpages $((256 * 256)) --save
</code></pre></div></div>

<h3 id="set-maximum-memory-256-x-memory-wanted">Set maximum memory 256 x memory wanted</h3>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ sudo vzctl set vpsid --privvmpages $((256 * 1024)) --save
</code></pre></div></div>

<h2 id="references">References</h2>

<ul>
  <li>http://wiki.openvz.org/Debian_template_creation</li>
  <li>http://wiki.openvz.org/Resource_shortage</li>
  <li>http://www.linux.com/archive/feature/114214</li>
</ul>

       ]]>
      </description>
    </item>
    
  </channel> 
</rss>
