<?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>Scienco.org &#187; Hetzner</title>
	<atom:link href="http://www.scienco.org/tag/hetzner/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scienco.org</link>
	<description>Life&#039;s too short to be unenthusiastic</description>
	<lastBuildDate>Wed, 14 Jul 2010 19:06:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<atom:link rel="next" href="http://www.scienco.org/tag/hetzner/feed/?page=2" />

		<item>
		<title>Ubuntu Server 8.04 as domU</title>
		<link>http://www.scienco.org/2008/ubuntu-server-804-as-domu/</link>
		<comments>http://www.scienco.org/2008/ubuntu-server-804-as-domu/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 10:23:32 +0000</pubDate>
		<dc:creator>Mikkel Meyer Andersen</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Xen]]></category>
		<category><![CDATA[Hetzner]]></category>
		<category><![CDATA[network bridge]]></category>

		<guid isPermaLink="false">http://www.scienco.org/?p=161</guid>
		<description><![CDATA[If you have followed the guide in &#8220;Xen on Ubuntu Server 8.04 (Hardy Heron) with complex disk setup&#8221; or have an environment similar to that, please read on &#8211; if not please read on, too . Since my server is hosted at Hetzner, this guide will be based on that. I want to use network [...]]]></description>
			<content:encoded><![CDATA[<p>If you have followed the guide in <a href="http://www.scienco.org/2008/xen-on-ubuntu-server-804-hardy-heron-with-complex-disk-setup/">&#8220;Xen on Ubuntu Server 8.04 (Hardy Heron) with complex disk setup&#8221;</a> or have an environment similar to that, please read on &#8211; if not please read on, too <img src='http://www.scienco.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . Since my server is hosted at Hetzner, this guide will be based on that. I want to use network bridging.<span id="more-161"></span> To do that you need additional IP-addresses. My host has <code>213.x.x.6</code> and besides that I&#8217;ve got <code>78.x.x.1</code>, <code>78.x.x.2</code>, &#8230;, <code>78.x.x.6</code> (plus a broadcasting address).On my host I&#8217;ve got this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># cat /etc/network/interfaces </span>
<span style="color: #666666; font-style: italic;">### Hetzner Online AG - installimage</span>
<span style="color: #666666; font-style: italic;"># Loopback device:</span>
auto lo
iface lo inet loopback
&nbsp;
<span style="color: #666666; font-style: italic;"># device: eth0</span>
auto eth0
iface eth0 inet static
  address 213.x.x.6
  broadcast 213.x.x.31
  netmask 255.255.255.224
  gateway 213.x.x.1
&nbsp;
<span style="color: #666666; font-style: italic;"># default route to access subnet</span>
up route add <span style="color: #660033;">-net</span> 213.x.x.0 netmask 255.255.255.224 gw 213.x.x.1 eth0
&nbsp;
auto eth0:<span style="color: #000000;">1</span>
iface eth0:<span style="color: #000000;">1</span> inet static
  address 78.x.x.1
  broadcast 78.x.x.7
  netmask 255.255.255.248</pre></div></div>

<p>The plan is that the guests will get <code>78.x.x.2</code>, <code>78.x.x.3</code>, etc. and will use <code>78.x.x.1</code> as gateway (you&#8217;ll see this later) &#8211; that&#8217;s why I&#8217;ve assigned it to the host.</p>
<p>Well, after you have found out that Xen kernel is loaded with</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">uname</span> <span style="color: #660033;">-r</span>
xm list</pre></div></div>

<p>you&#8217;ll be ready to proceed.</p>
<p>Now we want to make a domU with Ubuntu Server 8.04 with the program <code>debootstrap</code>. First identify the partitions you want to use. For the root filesystem I&#8217;ll use <code>/dev/lvmstore/lv1</code> and for swap I&#8217;ll use <code>/dev/sda6</code>. To prepare the partitions, please</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mkfs.xfs <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>lvmstore<span style="color: #000000; font-weight: bold;">/</span>lv1
mkswap <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda6</pre></div></div>

<p>Now it&#8217;s time to install the guest system. First mount the root file system like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>lvmstore<span style="color: #000000; font-weight: bold;">/</span>lv1 <span style="color: #000000; font-weight: bold;">/</span>mnt</pre></div></div>

<p>Now just install it with this simple command (depending on your environment you might have to change the <code>--arch</code>-parameter):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">debootstrap <span style="color: #660033;">--arch</span> amd64 hardy <span style="color: #000000; font-weight: bold;">/</span>mnt http:<span style="color: #000000; font-weight: bold;">//</span>archive.ubuntu.com<span style="color: #000000; font-weight: bold;">/</span>ubuntu</pre></div></div>

<p>Now you should copy a couple of files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-R</span> <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #000000; font-weight: bold;">`/*</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #000000; font-weight: bold;">`/</span></pre></div></div>

<p>Now you should change a couple of files. Now</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>network<span style="color: #000000; font-weight: bold;">/</span>interfaces</pre></div></div>

<p>should have the content</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># cat /mnt/etc/network/interfaces </span>
auto lo
iface lo inet loopback
&nbsp;
auto eth0
iface eth0 inet static
  address 78.x.x.2
  broadcast 78.x.x.7
  netmask 255.255.255.248
  gateway 78.x.x.1</pre></div></div>

<p>Here you see that I&#8217;m using the host as gateway.</p>
<p>And</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">hostname</span></pre></div></div>

<p>to change the hostname of the guest.</p>
<p>We also need to change the <code>fstab</code> &#8211; mine looks like this (remember to change <code>xfs</code> to <code>ext3</code> or similar if you&#8217;re not using xfs):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># cat /mnt/etc/fstab </span>
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda1 <span style="color: #000000; font-weight: bold;">/</span>    xfs  defaults <span style="color: #000000;">1</span> <span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda2 none swap sw       <span style="color: #000000;">0</span> <span style="color: #000000;">0</span></pre></div></div>

<p>The names <code>/dev/sda1</code> and <code>/dev/sda2</code> is assigned on a Xen configuration file  we&#8217;ll get to that i a minute.</p>
<p>Now we prepare the network bridge at the host by:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysctl.conf</pre></div></div>

<p>and change</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#net.ipv4.ip_forward=1</span></pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">net.ipv4.ip_forward=<span style="color: #000000;">1</span></pre></div></div>

<p>We also start the network bridge:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xen<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>network-bridge start</pre></div></div>

<p>Now reboot the host to enable the changes in <code>/etc/sysctl.conf</code>. After reboot please check that the bridge is okay:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brctl show</pre></div></div>

<p>Now we create the file <code>/etc/xen/domU1.conf</code> with this content:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># cat /etc/xen/domu1.cfg </span>
kernel      = <span style="color: #ff0000;">'/boot/vmlinuz-2.6.24-19-xen'</span>
ramdisk     = <span style="color: #ff0000;">'/boot/initrd.img-2.6.24-19-xen'</span>
memory      = <span style="color: #ff0000;">'512'</span>
maxmem      = <span style="color: #ff0000;">'1536'</span>
&nbsp;
root        = <span style="color: #ff0000;">'/dev/sda1 ro'</span>
disk        = <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'phy:/dev/lvmstore/lv1,sda1,w'</span>,<span style="color: #ff0000;">'phy:/dev/sda6,sda2,w'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
name        = <span style="color: #ff0000;">'domU1'</span>
&nbsp;
vif	     = <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'bridge=eth0'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
on_poweroff = <span style="color: #ff0000;">'destroy'</span>
on_reboot   = <span style="color: #ff0000;">'restart'</span>
on_crash    = <span style="color: #ff0000;">'restart'</span>
&nbsp;
vcpus	     = <span style="color: #ff0000;">'2'</span>
extra       = <span style="color: #ff0000;">'xencons=tty1'</span></pre></div></div>

<p>This is the specs of the guest. This is a configuration making you able to ballon the amount of memory to 1,5 GB instead of the initial 512 MB. Please view <code>man xmdomain.cfg</code> for further details.</p>
<p>Now start the guest (the <code>-c</code> means that the console is attached to the guest immediately):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">xm create <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xen<span style="color: #000000; font-weight: bold;">/</span>domu1.cfg <span style="color: #660033;">-c</span></pre></div></div>

<p>When the environment is started, login with the same password as on your host. Now check the network is okay, change the password, and update the system, respectively:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ping</span> 78.x.x.1
<span style="color: #c20cb9; font-weight: bold;">passwd</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> upgrade
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> dist-upgrade</pre></div></div>

<p>You&#8217;ll probably see some locales errors. For my case (da_DK) it&#8217;s fixed by this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">locale-gen da_DK.UTF8
tzselect
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;export LANG=C&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc</pre></div></div>

<p>Please refer to <a href="https://wiki.ubuntu.com/DebootstrapChroot">https://wiki.ubuntu.com/DebootstrapChroot</a> for details regarding this and debootstrap in general.</p>
<p>To shut it down, use</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">init <span style="color: #000000;">0</span></pre></div></div>

<p>You can start the guest without the <code>-c</code>-parameter to start it without the console. Then you can use</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">xm list</pre></div></div>

<p>to check that it&#8217;s running.</p>
<p>At this point I&#8217;d strongly recommend to shut the guest down, reboot the host (dom0) and start everything again. This is to verify that everything is also working after a reboot (before using it in production).</p>
<p>I followed <a href="http://www.howtoforge.com/high-performance-xen-on-ubuntu-8.04-amd64">http://www.howtoforge.com/high-performance-xen-on-ubuntu-8.04-amd64</a> when I installed the guest, but I&#8217;ve done it slightly different and avoided some of the errors.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scienco.org/2008/ubuntu-server-804-as-domu/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Xen on Ubuntu Server 8.04 (Hardy Heron) with complex disk setup</title>
		<link>http://www.scienco.org/2008/xen-on-ubuntu-server-804-hardy-heron-with-complex-disk-setup/</link>
		<comments>http://www.scienco.org/2008/xen-on-ubuntu-server-804-hardy-heron-with-complex-disk-setup/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 16:58:43 +0000</pubDate>
		<dc:creator>Mikkel Meyer Andersen</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Xen]]></category>
		<category><![CDATA[Hetzner]]></category>
		<category><![CDATA[LVM]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[xfs]]></category>

		<guid isPermaLink="false">http://www.scienco.org/?p=58</guid>
		<description><![CDATA[This is a tutorial about how to use Ubuntu Server 8.04 as dom0 (host) for Xen, i.e. how to install Xen on Ubuntu Server. In a later post I&#8217;ll show how to install domUs (guests). The whole setup is done with a rather complex disk configuration using both raid 1 (mirroring) and LVM. It requires [...]]]></description>
			<content:encoded><![CDATA[<p>This is a tutorial about how to use Ubuntu Server 8.04 as dom0 (host) for Xen, i.e. how to install Xen on Ubuntu Server. In a later post I&#8217;ll show how to install domUs (guests). The whole setup is done with a rather complex disk configuration using both raid 1 (mirroring) and LVM. It requires some knowledge about Xen (e.g. I&#8217;ll not try to convince you to use Xen &#8211; I assume it&#8217;s already your plan and you had read of all the advantages it gives you <img src='http://www.scienco.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ).<span id="more-58"></span></p>
<h3>Disk-layout considerations</h3>
<p>In order to use Windows with Xen you also need to have Intel VT or AMD-V &#8211; and have it enabled, too. My &#8220;metal&#8221; is a AMD-V enabled CPU, 4 GB RAM, 2 x 400 GB SATA II disks, and a 1 GBit NIC (network interface card) &#8211; a DS5000 at Hetzner. I&#8217;ve chosen to have a rather complex disk setup based on a lot of reading different places at the web (and for fun, too), e.g. [1], [2], [3], and [4]. First of all I want protection (raid 1 &#8211; mirroring) because I&#8217;m going to use the system in a production environment, but I don&#8217;t want to pay the money for a real hardware RAID controller, hence I&#8217;ve decided to use software raid, i.e. mdadm. I know it&#8217;s expensive in CPU-time, but I&#8217;m willing to &#8220;pay&#8221; for the protection this way. I want LVM for the domUs because it among other things enables me to take snapshots and easily grow/shrink the size of the disk.</p>
<p>The only thing I don&#8217;t want mirrored, is the swap-partitions. I know it might cause the system to crash if a disk fails, but only data in memory can be lost this way. If a swap-partition crashes it&#8217;s likely because the disk is dead, and as a back-up I want extra swap-partitions on the other disk so that I can use those until a new disk is installed. I don&#8217;t want the swap-partitions to be LVM &#8211; only normal partitions that can be mapped directly to domUs through Xen. Because of my metal, it&#8217;s not likely that I&#8217;m going to have more than 5 domUs running, hence I need 12 swap-partitions in total (the 5 plus 1 for dom0 and doubleing it to encounter the extra ones if a disk crashes). Because I don&#8217;t know if the memory of dom0 or a domU is going to be ballooned (resized &#8211; and yes, among many other things Xen i capable of that), I&#8217;ve decided to go with a size of 4GB of all the swap-partitions. It may be a little oversized, but better safe than sorry and I have plenty of disk space for my needs.</p>
<p>Of course the root file system of dom0 needs to be mirrored, but I don&#8217;t want to use LVM with this, because I&#8217;m not going to use any of the advantages with dom0. So this is going to be an ordinary raid 1 xfs partition. The rest of the disk space is used to make a VG (volume group) in LVM, and this pool can then be used to make LV (logical volumes) to disks for the domUs.</p>
<p>At this point please be aware that I&#8217;m going to map a LV to a domU to its root file system and a &#8220;normal&#8221; partition to its swap. Xen gives other possibilities, e.g. map a file on dom0 to the root file system of a domU or simply use a &#8220;normal&#8221; partition. All three choices have advantages and disadvantages; I&#8217;ve made my mind up and chosen to use the LVM-approach. I&#8217;ve also chosen to use xfs instead of ext3, but this choice really makes no difference in this tutorial: if you like ext3 better, then please use it.</p>
<h3>Disk layout</h3>
<p>If the two psysical 400GB disks are called /dev/sda and /dev/sdb, the disk-layout can be depicted as follows:</p>
<pre>disk	partition	size	usage/mount		pri/log
---------------------------------------------------------------
/dev/sda
	/dev/sda1	  1GB	/dev/md0 (bootable)	primary
	/dev/sda2	 20GB	/dev/md1 (dom0 -&gt; /)	primary
	/dev/sda5	  4GB	swap dom0		logical
	/dev/sda6	  4GB	dnu* (swap domU1)	logical
	/dev/sda7	  4GB	dnu* (swap domU2)	logical
	/dev/sda8	  4GB	dnu* (extra swap domU3)	logical
	/dev/sda9	  4GB	dnu* (extra swap domU4)	logical
	/dev/sda10	  4GB	dnu* (extra swap domU5)	logical
	/dev/sda11	 rest	/dev/md2 (LVM)		logical

/dev/sdb
	/dev/sdb1	  1GB	/dev/md0 (bootable)	primary
	/dev/sdb2	 20GB	/dev/md1 (dom0 -&gt; /)	primary
	/dev/sdb5	  4GB	dnu* (extra swap dom0)	logical
	/dev/sdb6	  4GB	dnu* (extra swap domU1)	logical
	/dev/sdb7	  4GB	dnu* (extra swap domU2)	logical
	/dev/sdb8	  4GB	dnu* (swap domU3)	logical
	/dev/sdb9	  4GB	dnu* (swap domU4)	logical
	/dev/sdb10	  4GB	dnu* (swap domU5)	logical
	/dev/sdb11	 rest	/dev/md2 (LVM)		logical

*dnu = DO NOT USE (is going to be mounted by the domUs)

/dev/md0 (bootable)
	/boot		  1GB	raid 1 (dom0 -&gt; /boot)

/dev/md1
	/		 20GB	raid 1 (dom0 -&gt; /)

/dev/md2
	/dev/lvmstore/lv1 15GB	/ (dom1)
	/dev/lvmstore/lv2 15GB	/ (dom2)
	/dev/lvmstore/lv3 15GB	/ (dom3)
	/dev/lvmstore/lv4 20GB	/ (dom4)
	...		 ... 	...</pre>
<h3>Installation</h3>
<p>The task of making this configuration in Ubuntu can be a bit confusing. How to make this configuration depends on the way you&#8217;re installing Ubuntu. I&#8217;ve had quite some troubles with LILO, so I recommend that you use GRUB instead! That&#8217;s also what [6] recommends.</p>
<p>As earlier mentioned, my server is hosted at Hetzner. Here you can only manipulate the installation through a configuration file. This means that the disk configuration has to be performed a bit different. You could of course also make this disk layout with the ordinary Ubuntu installer, but I&#8217;ll not get into details how to do that in this tutorial. First reboot into rescue mode and execute</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">installimage</pre></div></div>

<p>Now choose to edit the configuration file. First you need to enable software raid (thanks, [5]) and choose GRUB:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">SWRAID <span style="color: #000000;">1</span>
BOOTLOADER grub</pre></div></div>

<p>Furthermore I configured the hostname. I made the initial partitioning scheme like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">PART <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">/</span>boot ext3  1G
PART <span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">/</span>     xfs  20G
PART <span style="color: #000000;">3</span> swap  swap  4G</pre></div></div>

<p>And then I installed the system. After this was done, the disk layout needed to be modified heavily to get what we wanted.</p>
<p>Because we are going to modify the harddisk layout on a running system, be aware that you might delete data! Please make sure you have a backup of all important data. Also do not do this if you&#8217;re not able to restore the server somehow (boot it to rescue mode or similar if something should fail)!</p>
<p>First launch</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cfdisk <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda</pre></div></div>

<p>And perform these steps:</p>
<ul>
<li>Select sda3 and delete it</li>
<li>Create a new locigal partition of 4301.83 MB at the beginning and change type to 82 (Linux swap)</li>
<li>Create five new locigal partition of 4301.83 MB at the beginning and don&#8217;t change the type</li>
<li>Create a partition on the rest of space of type FD (Linux raid autodetect) &#8211; it&#8217;s going to be used for a mirrored LVM</li>
<li>Write  (don&#8217;t mind about the warning &#8220;No primary partitions are marked as bootable&#8221; &#8211; cfdisk doesn&#8217;t know the /dev/md0 is bootable)</li>
<li>Quit</li>
</ul>
<p>Now do almost the same with <code>/dev/sdb</code> by</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cfdisk <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdb</pre></div></div>

<p>And perform these steps:</p>
<ul>
<li>Select sdb3 and delete it</li>
<li>Create six new locigal partition of 4301.83 MB at the beginning and don&#8217;t change the type</li>
<li>Create a partition on the rest of space of type FD (Linux raid autodetect) &#8211; it&#8217;s going to be used for a mirrored LVM</li>
<li>Write (again, don&#8217;t mind about the warning &#8211; cfdisk doesn&#8217;t know the /dev/md0 is bootable)</li>
<li>Quit</li>
</ul>
<p>After this, my disk layout was like this:<br />
<a href="http://www.scienco.org/wp-content/dev-sda.png"><img class="aligncenter size-medium wp-image-143" title="/dev/sda" src="http://www.scienco.org/wp-content/dev-sda-300x172.png" alt="" width="300" height="172" /></a></p>
<p><a href="http://www.scienco.org/wp-content/dev-sdb.png"><img class="aligncenter size-medium wp-image-144" title="/dev/sdb" src="http://www.scienco.org/wp-content/dev-sdb-300x172.png" alt="" width="300" height="172" /></a></p>
<p>Use your favorite text editor (vim, nano or whatever) and:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>fstab</pre></div></div>

<p>Change</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md2 none swap sw <span style="color: #000000;">0</span> <span style="color: #000000;">0</span></pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda5 none swap sw <span style="color: #000000;">0</span> <span style="color: #000000;">0</span></pre></div></div>

<p>We also need to get <code>/dev/md2</code> removed from <code>mdadm</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mdadm<span style="color: #000000; font-weight: bold;">/</span>mdadm.conf</pre></div></div>

<p>Comment the line with <code>/dev/md2</code> out.</p>
<p>Now</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md2
mdadm <span style="color: #660033;">--manage</span> <span style="color: #660033;">--remove</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md2</pre></div></div>

<p>Again: be sure that if something fails, you&#8217;re able to enter some kind of rescue mode! If you are sure, please reboot to activate the new partiotions etc.</p>
<p>And now we check that /dev/md2 is gone:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>mdstat
mdadm <span style="color: #660033;">--detail</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md2
<span style="color: #c20cb9; font-weight: bold;">dmesg</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> md2</pre></div></div>

<p>Now please verify that the new swap is used be using</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">free</span></pre></div></div>

<p>to see how much free swap space is available (if it says 0 the system doesn&#8217;t use the swap). If there&#8217;s no swap space, try to initialize the new swap by</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mkswap <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda5</pre></div></div>

<p>and then reboot.</p>
<p>To create the mirroring of the LVM-storage, we perform:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mdadm <span style="color: #660033;">--create</span> <span style="color: #660033;">--verbose</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md2 <span style="color: #660033;">--level</span>=<span style="color: #000000;">1</span> <span style="color: #660033;">--raid-devices</span>=<span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda11 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdb11</pre></div></div>

<p>In order to get the array started on system start-up, execute this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mdadm <span style="color: #660033;">--brief</span> <span style="color: #660033;">--examine</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda11 <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mdadm<span style="color: #000000; font-weight: bold;">/</span>mdadm.conf</pre></div></div>

<p>Now we need to create the LVM (the lvmstore is the name, and LVs &#8211; logical volumes &#8211; will be located at /dev/lvmstore/name-of-lv):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pvcreate <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md2
vgcreate lvmstore <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>md2</pre></div></div>

<p>The output should be something like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># pvcreate /dev/md2</span>
  Physical volume <span style="color: #ff0000;">&quot;/dev/md2&quot;</span> successfully created
root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># vgcreate lvmstore /dev/md2</span>
  Volume group <span style="color: #ff0000;">&quot;lvmstore&quot;</span> successfully created</pre></div></div>

<p>Now you&#8217;re ready to create LVs. In my case I&#8217;m going to create three of 15 GB and one on 20 GB:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># lvcreate -n lv1 -L 15G lvmstore</span>
  Logical volume <span style="color: #ff0000;">&quot;lv1&quot;</span> created
root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># lvcreate -n lv2 -L 15G lvmstore</span>
  Logical volume <span style="color: #ff0000;">&quot;lv2&quot;</span> created
root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># lvcreate -n lv3 -L 15G lvmstore</span>
  Logical volume <span style="color: #ff0000;">&quot;lv3&quot;</span> created
root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># lvcreate -n lv4 -L 20G lvmstore</span>
  Logical volume <span style="color: #ff0000;">&quot;lv4&quot;</span> created
root<span style="color: #000000; font-weight: bold;">@</span>host:~<span style="color: #666666; font-style: italic;"># ls -l /dev/lvmstore</span>
total <span style="color: #000000;">0</span>
lrwxrwxrwx <span style="color: #000000;">1</span> root root <span style="color: #000000;">24</span> <span style="color: #000000;">2008</span>-08-02 <span style="color: #000000;">13</span>:<span style="color: #000000;">55</span> lv1 -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>lvmstore-lv1
lrwxrwxrwx <span style="color: #000000;">1</span> root root <span style="color: #000000;">24</span> <span style="color: #000000;">2008</span>-08-02 <span style="color: #000000;">13</span>:<span style="color: #000000;">55</span> lv2 -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>lvmstore-lv2
lrwxrwxrwx <span style="color: #000000;">1</span> root root <span style="color: #000000;">24</span> <span style="color: #000000;">2008</span>-08-02 <span style="color: #000000;">13</span>:<span style="color: #000000;">55</span> lv3 -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>lvmstore-lv3
lrwxrwxrwx <span style="color: #000000;">1</span> root root <span style="color: #000000;">24</span> <span style="color: #000000;">2008</span>-08-02 <span style="color: #000000;">13</span>:<span style="color: #000000;">55</span> lv4 -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>lvmstore-lv4</pre></div></div>

<p>Please reboot to be sure that everything&#8217;s alright.</p>
<h3>Post install</h3>
<p>First we&#8217;ll upgrade the system:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> upgrade
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> dist-upgrade
reboot</pre></div></div>

<p>This will reboot the machine in order to use a new kernel.</p>
<p>After the reboot, install Xen and tools for:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ubuntu-xen-server xen-tools xfsprogs</pre></div></div>

<p>Add this to <code>/etc/modules</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">loop <span style="color: #007800;">max_loop</span>=<span style="color: #000000;">64</span></pre></div></div>

<p>Now you need to deactivate a startup-script (by moving it), that makes it impossible for the machine to boot properly &#8211; at least everywhere I&#8217;ve tried (thanks to [7] for the solution!):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>loadcpufreq <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>loadcpufreq.backup</pre></div></div>

<p>If you don&#8217;t do this, the machine probably will not boot. At my server with Hetzner I was able to ping it though, but when I tried to SSH, I got a &#8220;Connection Resufed&#8221;.</p>
<p>Now reboot and verify running the Xen-kernel:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">uname</span> <span style="color: #660033;">-r</span>
xm list</pre></div></div>

<h3>Sources</h3>
<p>[1]: <a href="http://forums.novell.com/novell-product-support-forums/suse-linux-enterprise-server-sles/sles-virtualization/331444-suggest-swap-size-dom0.html">http://forums.novell.com/novell-product-support-forums/suse-linux-enterprise-server-sles/sles-virtualization/331444-suggest-swap-size-dom0.html</a><br />
[2]: <a href="http://www.gagme.com/greg/linux/raid-lvm.php">http://www.gagme.com/greg/linux/raid-lvm.php</a><br />
[3]: <a href="http://video.dkuug.dk/2007-10-16-xen/mr-xen.pdf">http://video.dkuug.dk/2007-10-16-xen/mr-xen.pdf</a><br />
[4]: <a href="http://www.howtoforge.com/high-performance-xen-on-ubuntu-8.04-amd64">http://www.howtoforge.com/high-performance-xen-on-ubuntu-8.04-amd64</a><br />
[5]: <a href="http://www.afterschool.dk/documents/hetzner/raid_hetzner_server/">http://www.afterschool.dk/documents/hetzner/raid_hetzner_server/</a><br />
[6]: <a href="http://wiki.debian.org/Xen">http://wiki.debian.org/Xen</a><br />
[7]: <a href="http://ubuntuforums.org/showthread.php?t=819404">http://ubuntuforums.org/showthread.php?t=819404</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.scienco.org/2008/xen-on-ubuntu-server-804-hardy-heron-with-complex-disk-setup/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
