<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Frederik&#039;s Blog &#187; KVM</title>
	<atom:link href="http://artipc10.vub.ac.be/wordpress/tag/kvm/feed/" rel="self" type="application/rss+xml" />
	<link>http://artipc10.vub.ac.be/wordpress</link>
	<description>Random thoughts of a Linux sysadmin</description>
	<lastBuildDate>Sat, 17 Dec 2011 19:05:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux performance improvements</title>
		<link>http://artipc10.vub.ac.be/wordpress/2011/05/27/linux-performance-improvements/</link>
		<comments>http://artipc10.vub.ac.be/wordpress/2011/05/27/linux-performance-improvements/#comments</comments>
		<pubDate>Fri, 27 May 2011 10:07:37 +0000</pubDate>
		<dc:creator>Frederik</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[CFS]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://artipc10.vub.ac.be/wordpress/?p=973</guid>
		<description><![CDATA[Two years ago I wrote an article presenting some Linux performance improvements. These performance improvements are still valid, but it is time to talk about some new improvements available. As I am using Debian now, I will focus on that distribution, but you should be able to easily implement these things on other distributions too. [...]]]></description>
			<content:encoded><![CDATA[<p>Two years ago I wrote<a title="Speeding up my Linux system" href="http://artipc10.vub.ac.be/wordpress/2009/07/08/speeding-up-my-linux-system/"> an article presenting some Linux performance improvements</a>. These performance improvements are still valid, but it is time to talk about some new improvements available. As I am using Debian now, I will focus on that distribution, but you should be able to easily implement these things on other distributions too. Some of these improvements are best suited for desktop systems, other for server systems and some are useful for both.<span id="more-973"></span></p>
<h1>System update</h1>
<p>First of all, it is important that your system is up to date. Update it to Debian testing if you have not done that yet. It will give your, amongst others:</p>
<ul>
<li>Updated <a href="http://www.eglibc.org/cgi-bin/viewcvs.cgi/branches/eglibc-2_13/libc/NEWS?view=markup">eglibc 2.13</a>, which includes functions optimized for instruction sets SSE2, SSSE3&nbsp; and SSE4.2 provided by recent processors</li>
<li>Updated <a href="http://gcc.gnu.org/gcc-4.5/changes.html">GCC 4.5</a> (with <a href="http://gcc.gnu.org/gcc-4.6/changes.html">GCC 4.6</a> being on the way)</li>
<li>Updated graphics stack with Xserver 1.10, Mesa 7.10.2 and new X drivers and up to date pixman and cairo libraries, all improving performance</li>
<li>A recent kernel which brings improvements to process and disk schedulers, better hardware drivers, transparant hugepages (see further), scalability improvements to the EXT4 and XFS file systems and the Virtual File System layer, vhost-net for reduced network latency for KVM virtual machines and more. Debian testing has a 2.6.38 kernel, while 2.6.39 is available in unstable and will migrate to testing in the near future.</li>
<li>Parts of GNOME 2.32, such as Evolution which has improved start-up performance and important bug fixes (for example support of mailboxes larger than 2GB)</li>
<li>Iceweasel 4 is available in Debian Experimental and the upcoming 5 version, bringing even more performance improvements, is already available in an <a href="http://mozilla.debian.net">external repository</a>.</li>
</ul>
<h1>Transparant hugepages</h1>
<p>Transparant hugepages is a feature introduced in Linux 2.6.38 which can improve performance of applications. The processor has a translation lookaside buffer (TLB) which is a CPU cache used to speed up mapping of virtual memory addresses to physical memory addresses. This TLB has a limited size. By transparently combining several small 4 KB pages to larger &#8220;hugepages&#8221;,&nbsp; more pages can fit into the TLB. Transparent hugepages can be enabled on the fly, however it will only have effect on applications started after you have enabled this feature. For this reason, it is best to activate it right from the start by using a kernel boot parameter. With transparent_hugepage=always, the kernel will use transparant hugepages for any process. If you want to use transparent hugepages only for applications which explicitly indicate that they prefer hugepages, you can use transparent_hugepage=madvise. You have to add one of these boot parameters to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub in Debian, and run the update-grub command. At the next boot, you can take a look at the contents of the /sys/kernel/mm/transparent_hugepage file to verify that it is really enabled.</p>
<p>More information:</p>
<ul>
<li><a href="https://lwn.net/Articles/423584/">https://lwn.net/Articles/423584/</a></li>
<li><a href="https://lwn.net/Articles/423592/">https://lwn.net/Articles/423592/</a></li>
</ul>
<h1>Tuning ondemand cpufreq governor</h1>
<p>The ondemand cpufreq governor (which should be used on most systems by default; make sure you have Debbian&#8217;s cpufrequtils package installed) tends to switch back to slower CPU frequency speeds a bit too early in some cases, hurting performance. By setting the sampling_down_factor to a value higher than 1, you can prevent it from reducing the clock speed too quickly.</p>
<p>I have added this to my /etc/rc.local script:<br />
<code><br />
if test -f /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor<br />
then<br />
&nbsp;&nbsp;&nbsp;&nbsp;echo 10 &gt; /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor<br />
fi</code></p>
<p>On server systems, I even use 100 instead of 10.</p>
<p>More information:</p>
<ul>
<li><a href="https://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3f78a9f7fcee0e9b44a15f39ac382664e301fad5">https://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3f78a9f7fcee0e9b44a15f39ac382664e301fad5</a></li>
<li><a href="https://forums.gentoo.org/viewtopic-t-877539.html?sid=bb3b956d1960647972fc73b3458ff6c8">https://forums.gentoo.org/viewtopic-t-877539.html?sid=bb3b956d1960647972fc73b3458ff6c8</a></li>
</ul>
<h1>VM dirty ratio</h1>
<p>By default the VM dirty ratio is set to 20% and the background dirty ratio is set to 10%. This means that when 10% of memory is filled with dirty pages (cached data which has to be flushed to disk), the kernel will start writing out the data to disk into the background, without interrupting processes. If the amount of dirty pages raises up to 20%, processes will be forced to write out data to disk and cannot continue other work before they have done so.</p>
<p>By increasing these values, more data will be cached into memory, and data will be written out in larger I/O streams. This can be a good thing on servers with fast storage and lots of memory.</p>
<p>To increase these values, create a file /etc/sysctl.d/dirty_ratio.conf with these contents:<br />
<code><br />
vm.dirty_ratio = 40<br />
vm.dirty_background_ratio = 15</code></p>
<p>Then with the command &lt;code&gt;sysctl -p /etc/sysctl.d/dirty_ratio.conf&lt;/code&gt; you make these settings become in effect immediately.</p>
<p>On desktop systems, the default dirty_ratio of 20 and dirty_background_ratio of 10 should be reasonable. You do not want a too high dirty_ratio on desktop systems, because applications will stall for too long if they have to write out all these dirty pages at once.</p>
<p>More information:</p>
<ul>
<li><a href="http://www.kernel.org/doc/Documentation/sysctl/vm.txt">http://www.kernel.org/doc/Documentation/sysctl/vm.txt</a></li>
<li><a href="http://www.scribd.com/doc/46600383/RHEL-Perf-Tuning">http://www.scribd.com/doc/46600383/RHEL-Perf-Tuning</a></li>
</ul>
<h1>CFS scheduler tuning</h1>
<p>CFS (Competely Fair Scheduler) is the name of the Linux process scheduler. By default it is tuned for desktop workloads. For server systems where throughput is more important than latency, <a href="http://git.fedorahosted.org/git/?p=tuned.git;a=blob_plain;f=tune-profiles/throughput-performance/sysctl.ktune;hb=HEAD">Red Hat&#8217;s tuned package</a> proposes these sysctl settings for CFS for servers:<code><br />
kernel.sched_min_granularity_ns = 10000000<br />
kernel.sched_wakeup_granularity_ns = 15000000</code></p>
<p>More information:</p>
<ul>
<li><a href="http://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt">http://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt</a></li>
</ul>
<h1>ulatencyd</h1>
<p>ulatencyd is a daemon which uses cgroups to give hints to the  kernel&#8217;s process scheduler CFS to improve desktop latency and make  applications feel more responsive. It will prevent individual applications from hogging the system, slowing down other applications .  This is somewhat simpler than the much hyped (but controversial) <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Completely_Fair_Scheduler#Fairer_algorithms">autogroup kernel patch</a> but this solution is much more extensive in that ulatencyd knows  different applications and desktops and knows how to configure the  scheduler to improve responsiveness.</p>
<p>On Debian, you install the ulatencyd package and start the ulatencyd  init script. The ulatency package contains the ulatency client too,  which shows you the cgroups ulatencyd has set up.</p>
<p>In my opinion, ulatencyd is great for desktop systems but I do not recommend to install this on server systems.</p>
<p>More information:</p>
<ul>
<li><a href="https://github.com/poelzi/ulatencyd/wiki">https://github.com/poelzi/ulatencyd/wiki</a></li>
</ul>
<h1>KVM performance improvements</h1>
<p>When using Linux guests in kvm virtual machines, it is important to configure the network interface and hard drive as <a href="http://wiki.libvirt.org/page/Virtio">virtio</a> devices in order to experience the best performance. KVM also benefits from transparant hugepages: be sure to enable them both in the host as in the guest machine.</p>
<p>More information:</p>
<ul>
<li><a href="http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaav/LPC/LPCKVMSSPV2.1.pdf">http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaav/LPC/LPCKVMSSPV2.1.pdf</a></li>
<li><a href="http://www.linux-kvm.org/page/Tuning_KVM">http://www.linux-kvm.org/page/Tuning_KVM</a></li>
</ul>
<h2>VHostNet</h2>
<p>VHostNet improves network latency and throughput of KVM guests. To enable it, you need to load the vhost_net kernel module in your host system. In Debian you can add vhost_net to /etc/modules to load it automatically when booting the system. Then if you use libvirt to manage your virtual machines, VHostNet will be used automatically when starting virtual machines. If you start qemu-kvm by hand, you will need to add the vhost=on option to the netdev device.</p>
<p>More information:</p>
<ul>
<li><a href="http://www.linux-kvm.org/page/VhostNet">http://www.linux-kvm.org/page/VhostNet</a></li>
</ul>
<h2>Raw devices, disable cache and choose deadline I/O scheduler</h2>
<p>For best performance, raw devices are recommended instead of qcow2 or other image files. In libvirt/virt-manager I have defined a storage pool on an LVM volume group, and let virt-install create logical volumes on it containing raw images.</p>
<p>It is recommended to disable I/O caching in KVM because it reduces data copies and bus traffic. In the libvirt XML file for your virtual machine, set the cache=&#8217;none&#8217; attribute for the driver tag for the disk device. You can also use virt-manager to make this change: look for the cache mode under the advanced options for the disk.</p>
<p>Benchmarks seems to indicate that it is best to to use the deadline I/O scheduler instead of the default CFQ scheduler.&nbsp; Using deadline in the guest seems also beneficial.&nbsp; To make deadline the default scheduler, edit /etc/default/grub.conf and add elevator=deadline to the<cite> </cite>GRUB_CMDLINE_LINUX_DEFAULT variable.</p>
<p>More information:</p>
<ul>
<li><a href="http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaat/liaatbpioschedulers.htm">http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaat/liaatbpioschedulers.htm</a></li>
</ul>
<h2>Native AIO</h2>
<p>Native AIO offers better performance than the thread based AIO in KVM. However, it should only be enabled on raw images, because it can lead to disk corruption in some cases otherwise. This problem is supposed to be fixed in recent kernels according to information I got on the <a href="irc://irc.freenode.org/#kvm">#kvm IRC channel</a>, but better be safe than sorry.</p>
<p>To enable this, add the parameter io=&#8217;native&#8217; to the driver tag of the disk in the XML file for the virtual machine in libvirt.</p>
<ul>
<li><a href="https://access.redhat.com/kb/docs/DOC-40644">https://access.redhat.com/kb/docs/DOC-40644</a></li>
</ul>
<h2>CPU features</h2>
<p>By default, KVM only provides a common limited set of CPU instructions implemented by different CPU&#8217;s from Intel and AMD. This is needed to permit live migration of a virtual machine to hardware with a CPU which does not implement all instructions available in the original system. If you do not plan on doing doing that, you can enable all instruction sets of your host CPU in the virtual machines, so that your virtual machine can make use of all advanced features of your CPU (for example SSE3 and others). The easiest way to do this, is by using virt-manager. Click on &#8220;Copy host configuration&#8221; in the Processor &#8211; Configuration settings of the virtual machine. The next time you start up the virtual machine, it will have access to all extended instruction sets of your CPU.</p>
<h2>KSM</h2>
<p>Kernel Samepage Merging is a kernel feature which merges identical pages in memory. If you are using different virtual machines, with the same operating system and applications running in it, lots of memory pages will actually be identical. KSM will save memory by merging the identical pages.</p>
<p>To enable this on Debian, I have put this in my /etc/rc.local script:<br />
<code><br />
echo 1 &gt; /sys/kernel/mm/ksm/run<br />
echo 200 &gt; /sys/kernel/mm/ksm/sleep_millisecs<br />
</code></p>
<p>The last line is optional. It raises the interval during two different memory scans, so that the CPU is not too busy scanning for duplicate memory pages all the time.</p>
<p>More information:</p>
<ul>
<li><a href="http://www.linux-kvm.org/page/KSM">http://www.linux-kvm.org/page/KSM</a></li>
</ul>
<ul>
<li><a href="http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=/liaat/liaatbpioschedulers.htm">http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=/liaat/liaatbpioschedulers.htm</a></li>
</ul>
<h1>zram disk</h1>
<p>If you do not have much RAM available in your system, it is useful to compress part of the data in memory. This can be done by using a zram disk, which is a ram disk on which all data is transparently compressed. On this zram disk you create a swap partition which you give a higher priority than the normal on disk swap space. Once the available RAM (total RAM &#8211; RAM reserved for zram disk) is used, data will be swapped out to the zram disk, which is much faster than swap space on a rotating hard disk. This way, more data fits into the RAM.</p>
<p>On my 1 GB netbook system which runs a full GNOME desktop, I have reserved 512 MB for the zram disk. To do so, I added the following in /etc/rc.local:</p>
<p><code>echo $((512*1024*1024)) &gt; /sys/block/zram0/disksize<br />
mkswap /dev/zram0<br />
swapon -p 60 /dev/zram0</code></p>
<p>Of course, a better solution is to add RAM to your system, especially on server systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://artipc10.vub.ac.be/wordpress/2011/05/27/linux-performance-improvements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server migration to Debian</title>
		<link>http://artipc10.vub.ac.be/wordpress/2010/10/04/server-migration-to-debian/</link>
		<comments>http://artipc10.vub.ac.be/wordpress/2010/10/04/server-migration-to-debian/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 17:19:19 +0000</pubDate>
		<dc:creator>Frederik</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[HP Proliant DL185G5]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[Mandriva]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Squeeze]]></category>

		<guid isPermaLink="false">http://artipc10.vub.ac.be/wordpress/?p=815</guid>
		<description><![CDATA[Since this afternoon, this server is now running Debian GNU/Linux Squeeze. Just like the previous system, this is a KVM virtual machine running on a HP Proliant DL185G5 host. The host server has always been running Debian. This was my last production system still running Mandriva. I might have forgotten to move over a few [...]]]></description>
			<content:encoded><![CDATA[<p>Since this afternoon, this server is now running Debian GNU/Linux Squeeze. Just like the previous system, this is a KVM virtual machine running on a HP Proliant DL185G5 host. The host server has always been running Debian. This was my last production system still running Mandriva. I might have forgotten to move over a few things or there might be some breakage somewhere, so let me know if you encounter a problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://artipc10.vub.ac.be/wordpress/2010/10/04/server-migration-to-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A wise server migration</title>
		<link>http://artipc10.vub.ac.be/wordpress/2010/08/07/a-wise-server-migration/</link>
		<comments>http://artipc10.vub.ac.be/wordpress/2010/08/07/a-wise-server-migration/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 21:48:34 +0000</pubDate>
		<dc:creator>Frederik</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Dell]]></category>
		<category><![CDATA[Dokuwiki]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[power consumption]]></category>
		<category><![CDATA[Poweredge R410]]></category>
		<category><![CDATA[Squeeze]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[Wise]]></category>

		<guid isPermaLink="false">http://artipc10.vub.ac.be/wordpress/?p=662</guid>
		<description><![CDATA[Yesterday I migrated two servers at work to a new machine. The old machines were pretty underpowered: a Pentium III 1 Ghz system (with 384 MB RAM if I remember correctly) and a Pentium 4 system. The new machine is a Dell Poweredge R410 with a Xeon E5504 processor, 12 GB RAM and a PERC [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I migrated two servers at work to a new machine. The old machines were pretty underpowered: a Pentium III 1 Ghz system (with 384 MB RAM if I remember correctly) and a Pentium 4 system. The new machine is a Dell Poweredge R410 with a Xeon E5504 processor, 12 GB RAM and a PERC H700 RAID controller (which is actually a LSI MegaSAS 9260) with 3 750 GB SATA disks in RAID 5. The hardware is pretty nice (although I am not happy at all with the way Dell treats its customers, so I will rather prefer other vendors in the future, but maybe more about that in a later post).</p>
<p>The old servers were running Debian Lenny, while the new server runs Debian Squeeze, which is frozen since yesterday. That was a nice coincidence. The new server actually hosts three virtual machines using the Linux KVM virtualization system. One of them hosts the website <a href="http://wise.vub.ac.be"> http://wise.vub.ac.be</a>, a second VM hosts a file server, and a third VM is the gateway for a small internal network.</p>
<p>The migration went pretty well, except for the smaller problems which you can always expect with such things, for example a Java web application which had hard-coded host names which had changed. The update to PHP 5.3 caused some compatibility problems which I already fixed before the migration itself: Dokuwiki had to be updated to a recent version in order to not show any warnings. There was also a website based on Joomla 1.0,  which is actually not supported anymore. As updating it to a recent version was not really an option, I found some posts on the web on how to fix the errors I was seeing and cooked up a simple <a href="/wordpress/wp-content/uploads/joomla.patch">patch</a>.</p>
<p>The new server is using 140 Watts most of the time. Keeping in mind that in the future it will also replace a third old server, that will probably be a nice reduction of power consumption compared to the old situation.</p>
]]></content:encoded>
			<wfw:commentRss>http://artipc10.vub.ac.be/wordpress/2010/08/07/a-wise-server-migration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migration to virtual machine</title>
		<link>http://artipc10.vub.ac.be/wordpress/2009/09/09/migration-to-virtual-machine/</link>
		<comments>http://artipc10.vub.ac.be/wordpress/2009/09/09/migration-to-virtual-machine/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 21:17:00 +0000</pubDate>
		<dc:creator>Frederik</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mandriva]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://artipc10.vub.ac.be/wordpress/?p=283</guid>
		<description><![CDATA[I just finished migrating this website to a new KVM virtual machine. The virtual machine is running Mandriva Cooker (2010.0) now with kernel 2.6.31-rc9 and the virtio drivers. The host machine is a HP DL185 G5 running Debian Lenny (kernel 2.6.26) and kvm 85. During the next days, there might be some short downtime now [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished migrating this website to a new KVM virtual machine. The virtual machine is running Mandriva Cooker (2010.0) now with kernel 2.6.31-rc9 and the virtio drivers. The host machine is a HP DL185 G5 running Debian Lenny (kernel 2.6.26) and kvm 85.</p>
<p>During the next days, there might be some short downtime now and then while I continue configuring things</p>
]]></content:encoded>
			<wfw:commentRss>http://artipc10.vub.ac.be/wordpress/2009/09/09/migration-to-virtual-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server migration</title>
		<link>http://artipc10.vub.ac.be/wordpress/2009/07/01/server-migration/</link>
		<comments>http://artipc10.vub.ac.be/wordpress/2009/07/01/server-migration/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 21:34:58 +0000</pubDate>
		<dc:creator>Frederik</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://artipc10.vub.ac.be/wordpress/?p=221</guid>
		<description><![CDATA[Since two days, I have merged the main servers used by two research laboratories at work. One server was an old Linux server which really needed a hardware upgrade, and the other one was a Mac Pro machine running a flaky OS X Leopard. The new server is of course running Linux: Debian Lenny. It [...]]]></description>
			<content:encoded><![CDATA[<p>Since two days, I have merged the main servers used by two research laboratories at work. One server was an old Linux server which really needed a hardware upgrade, and the other one was a Mac Pro machine running a flaky OS X Leopard. The new server is of course running Linux: Debian Lenny.</p>
<p>It was a very interesting experience: working out procedures to migrate the mailboxes (from Dovecot on the Linux server and Cyrus on the Mac server to Cyrus on the new server), finding out how to set up one NIC in two different subnets (especially the routing is a little bit tricky), getting all services hooked up to LDAP and managed by <a href="https://oss.gonicus.de/labs/gosa/">GOSA</a>, getting dhcpd to do exactly what we want in a shared-network set up, and much more.</p>
<p>The new server is a <a href="http://h10010.www1.hp.com/wwpc/us/en/sm/WF05a/15351-15351-3328412-241644-3328421-3579900.html">HP DL185 G5</a> with an AMD Opteron quad core CPU and 8 GB of RAM and hosts two KVM virtual machines, one for public services and another one running internal services. You can visit the two websites, which are also hosted on this machine of course, of the concerned research labs:</p>
<ul>
<li><a href="http://arti.vub.ac.be">Artificial Intelligence Laboratory</a></li>
<li><a href="http://como.vub.ac.be">Computational Modeling Lab</a></li>
</ul>
<p>Maybe in the not too far away future, I should try to move the services hosted on the underpowered desktop machine running this website, also to a virtual machine&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://artipc10.vub.ac.be/wordpress/2009/07/01/server-migration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using KVM on Mandriva 2009.0</title>
		<link>http://artipc10.vub.ac.be/wordpress/2008/11/02/using-kvm-on-mandriva-20090/</link>
		<comments>http://artipc10.vub.ac.be/wordpress/2008/11/02/using-kvm-on-mandriva-20090/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 19:37:51 +0000</pubDate>
		<dc:creator>Frederik</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mandriva]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Dell Latitude E6400]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://artipc10.vub.ac.be/wordpress/uncategorized/using-kvm-on-mandriva-20090.html</guid>
		<description><![CDATA[Introduction My new Dell Latitude E6400 laptop, is my first system which support hardware visualization. It also has 4 GB RAM, making this an ideal machine to start experimenting with KVM, the kernel based virtual machine system which is now integrated in Linux itself. In the past I had already used different virtualization systems. VMWare [...]]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>My new Dell Latitude E6400 laptop, is my first system which support hardware visualization. It also has 4 GB RAM, making this an ideal machine to start experimenting with <a href="http://kvm.qumranet.com">KVM</a>, the kernel based virtual machine system which is now integrated in Linux itself.</p>
<p>In the past I had already used different virtualization systems. <a href="http://www.vmware.com/products/server/">VMWare Server</a> is annoying because you have to rebuild the kernel modules by hand each time you install a new kernel and it&#8217;s not Free (as in Free Speech). <a href="http://www.virtualbox.org/">Virtualbox</a> handles the modules rebuild nicely thanks to the use of DKMS in Mandriva, but always <a href="http://www.virtualbox.org/ticket/616">randomly crashes on an assert</a>, making it totally unusable for serious work. Also it does not really include a server mode, where virtual machines just run in the background. <a href="http://www.xen.org/">Xen</a> is especially nice if you have a system which does not support hardware virtualization and you just want to run a paravirtualized Linux in it. However, the host system (Dom0) needs to run a very specific kernel version (normally version 2.6.18, although Debian has a 2.6.26 based one now). <a href="http://wiki.openvz.org">OpenVZ</a> is nice for lightweight Linux server containers (some kind of chroot on steroids), but is not a complete virtualization solution.</p>
<p>Because KVM is built into the standard Linux kernel, this means there won&#8217;t be any problems with kernel modules which have to be installed separately. It&#8217;s a complete virtualization system which means that you can run all kind of operating systems on it, like for example also Windows. KVM is evolving <a href="http://kvm.qumranet.com/kvmwiki/ChangeLog">very quickly</a> and its performance and features are constantly improving. Thanks to <a href="http://libvirt.org/">libvirt</a> and <a href="http://virt-manager.et.redhat.com/">virt-manager</a>, it also has a nice GUI front-end which make configuring and managing virtual machines very easy (libvirt and virt-manager also include support for Xen and OpenVZ, but I don&#8217;t know how well that works).</p>
<h1>Installing and using KVM on Mandriva 2009.0</h1>
<p>Before installing KVM, it&#8217;s important to verify that the CPU on your system has hardware virtualization support. Start up a terminal, and run</p>
<p><code><br />
$ cat /proc/cpuinfo<br />
</code></p>
<p>If you have an Intel CPU, you should have vmx in the flags. If you are using an AMD CPU, you should have svm.</p>
<p>It&#8217;s best to use KVM, libvirt and virt-manager from Mandriva&#8217;s backports repositories. The versions included there, are the most recent ones, and fix a few problems which made networking not work out of the box with the ones included in the standard repositories. So start up the Mandriva Control Center (Tools &#8211; System Tools &#8211; Configure Your Computer), and in the Software category, launch the media sources configuration tool and enable the Main Backports and Contrib Backports sources by checking the checkboxes.</p>
<p>Before we install the necessary packages, it&#8217;s necessary to make a change to udev&#8217;s configuration file to prevent the virbr* and vnet* virtual ethernet devices and bridges being configured automatically by Mandriva&#8217;s configuration tools. To do so, edit the file /etc/sysconfig/udev_net and add virbr* and vnet* to the BLACKLIST_ALL line if they are not there yet. The line should look like this:</p>
<p><code>BLACKLIST_ALL="ppp*|ippp*|isdn*|plip*|hso*|lo*|irda*|dummy*|ipsec*|vmnet*|wifi*|<br />
wmaster*|br*|vbd*|vtpm*|vif*|ax*|nr*|rose*|bce*|scc*|virbr*|vnet*"</code><br />
Then install the kvm and virt-manager packages with the graphical software installation utility or with urpmi. Some extra dependencies will be installed, such as dnsmasq-base, libvirt-utils and python-virtinst.</p>
<p>After the installation, make sure that the libvirtd service is running. You can use the graphical tool in the Mandriva Control Center in the category System &#8211; Manager system services, or you can run &#8220;service libvirtd status&#8221; to verify whether it&#8217;s running and &#8220;service libvirtd start&#8221; to start it.</p>
<p>Now start the Virtual Machine Manager from Tools &#8211; Emulators. Choose File &#8211; Add Connection and set up a Local QEMU connection. Double click on the localhost/qemu connection in the virtual machine manager, and enter your root password. You can now create new virtual machines by clicking on the New button. To use KVM, choose a fully virtualized system, and choose KVM as hypervisor. If you want to run Mandriva 2009.0 or later in a KVM based virtual machine, you can probably choose Linux as OS type and Ubuntu Hardy as OS variant, because that should give better performance than the generic options.</p>
<p>I currently have Windows Vista and Debian Lenny running in KVM. It works very fast and very reliably. The only problem I encounter, is that sometimes I cannot switch back from my Windows virtual machine to my host system: the mouse and keyboard cannot leave the VNC window anymore and also the Ctrl-Alt keystroke does not release the mouse pointer. The only solution is to shut down the Windows system.</p>
]]></content:encoded>
			<wfw:commentRss>http://artipc10.vub.ac.be/wordpress/2008/11/02/using-kvm-on-mandriva-20090/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

