]> pere.pagekite.me Git - homepage.git/blobdiff - blog/index.rss
Generated.
[homepage.git] / blog / index.rss
index 888b692567383feec6b9f629774e407004b4eae6..f5b5213a21733cdeead1afe2f9efe57b50f44735 100644 (file)
@@ -6,6 +6,87 @@
                 <link>http://people.skolelinux.org/pere/blog/</link>
                 <atom:link href="http://people.skolelinux.org/pere/blog/index.rss" rel="self" type="application/rss+xml" />
        
+       <item>
+               <title>Migrating Xen virtual machines using LVM to KVM using disk images</title>
+               <link>http://people.skolelinux.org/pere/blog/Migrating_Xen_virtual_machines_using_LVM_to_KVM_using_disk_images.html</link>
+               <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Migrating_Xen_virtual_machines_using_LVM_to_KVM_using_disk_images.html</guid>
+                <pubDate>Mon, 22 Nov 2010 11:20:00 +0100</pubDate>
+               <description>
+&lt;p&gt;Most of the computers in use by the
+&lt;a href=&quot;http://www.skolelinux.org/&quot;&gt;Debian Edu/Skolelinux project&lt;/a&gt;
+are virtual machines.  And they have been Xen machines running on a
+fairly old IBM eserver xseries 345 machine, and we wanted to migrate
+them to KVM on a newer Dell PowerEdge 2950 host machine.  This was a
+bit harder that it could have been, because we set up the Xen virtual
+machines to get the virtual partitions from LVM, which as far as I
+know is not supported by KVM.  So to migrate, we had to convert
+several LVM logical volumes to partitions on a virtual disk file.&lt;/p&gt;
+
+&lt;p&gt;I found
+&lt;a href=&quot;http://searchnetworking.techtarget.com.au/articles/35011-Six-steps-for-migrating-Xen-virtual-machines-to-KVM&quot;&gt;a
+nice recipe&lt;/a&gt; to do this, and wrote the following script to do the
+migration.  It uses qemu-img from the qemu package to make the disk
+image, parted to partition it, losetup and kpartx to present the disk
+image partions as devices, and dd to copy the data.  I NFS mounted the
+new servers storage area on the old server to do the migration.&lt;/p&gt;
+
+&lt;pre&gt;
+#!/bin/sh
+
+# Based on
+# http://searchnetworking.techtarget.com.au/articles/35011-Six-steps-for-migrating-Xen-virtual-machines-to-KVM
+
+set -e
+set -x
+
+if [ -z &quot;$1&quot; ] ; then
+    echo &quot;Usage: $0 &amp;lt;hostname&amp;gt;&quot;
+    exit 1
+else
+    host=&quot;$1&quot;
+fi
+
+if [ ! -e /dev/vg_data/$host-disk ] ; then
+    echo &quot;error: unable to find LVM volume for $host&quot;
+    exit 1
+fi
+
+# Partitions need to be a bit bigger than the LVM LVs.  not sure why.
+disksize=$( lvs --units m | grep $host-disk | awk &#39;{sum = sum + $4} END { print int(sum * 1.05) }&#39;)
+swapsize=$( lvs --units m | grep $host-swap | awk &#39;{sum = sum + $4} END { print int(sum * 1.05) }&#39;)
+totalsize=$(( ( $disksize + $swapsize ) ))
+
+img=$host.img
+#dd if=/dev/zero of=$img bs=1M count=$(( $disksize + $swapsize ))
+qemu-img create $img ${totalsize}MMaking room on the Debian Edu/Sqeeze DVD
+
+parted $img mklabel msdos
+parted $img mkpart primary linux-swap 0 $disksize
+parted $img mkpart primary ext2 $disksize $totalsize
+parted $img set 1 boot on
+
+modprobe dm-mod
+losetup /dev/loop0 $img
+kpartx -a /dev/loop0
+
+dd if=/dev/vg_data/$host-disk of=/dev/mapper/loop0p1 bs=1M
+fsck.ext3 -f /dev/mapper/loop0p1 || true
+mkswap /dev/mapper/loop0p2
+
+kpartx -d /dev/loop0
+losetup -d /dev/loop0
+&lt;/pre&gt;
+
+&lt;p&gt;The script is perhaps so simple that it is not copyrightable, but
+if it is, it is licenced using GPL v2 or later at your discretion.&lt;/p&gt;
+
+&lt;p&gt;After doing this, I booted a Debian CD in rescue mode in KVM with
+the new disk image attached, installed grub-pc and linux-image-686 and
+set up grub to boot from the disk image.  After this, the KVM machines
+seem to work just fine.&lt;/p&gt;
+</description>
+       </item>
+       
        <item>
                <title>Lenny-&gt;Squeeze upgrades, apt vs aptitude with the Gnome and KDE desktop</title>
                <link>http://people.skolelinux.org/pere/blog/Lenny__Squeeze_upgrades__apt_vs_aptitude_with_the_Gnome_and_KDE_desktop.html</link>
@@ -733,44 +814,5 @@ NRK1. :)&lt;/p&gt;
 </description>
        </item>
        
-       <item>
-               <title>Software updates 2010-10-24</title>
-               <link>http://people.skolelinux.org/pere/blog/Software_updates_2010_10_24.html</link>
-               <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Software_updates_2010_10_24.html</guid>
-                <pubDate>Sun, 24 Oct 2010 22:45:00 +0200</pubDate>
-               <description>
-&lt;p&gt;Some updates.&lt;/p&gt;
-
-&lt;p&gt;My &lt;a href=&quot;http://pledgebank.com/gnash-avm2&quot;&gt;gnash pledge&lt;/a&gt; to
-raise money for the project is going well.  The lower limit of 10
-signers was reached in 24 hours, and so far 13 people have signed it.
-More signers and more funding is most welcome, and I am really curious
-how far we can get before the time limit of December 24 is reached.
-:)&lt;/p&gt;
-
-&lt;p&gt;On the #gnash IRC channel on irc.freenode.net, I was just tipped
-about what appear to be a great code coverage tool capable of
-generating code coverage stats without any changes to the source code.
-It is called
-&lt;a href=&quot;http://simonkagstrom.github.com/kcov/index.html&quot;&gt;kcov&lt;/a&gt;,
-and can be used using &lt;tt&gt;kcov &amp;lt;directory&amp;gt; &amp;lt;binary&amp;gt;&lt;/tt&gt;.
-It is missing in Debian, but the git source built just fine in Squeeze
-after I installed libelf-dev, libdwarf-dev, pkg-config and
-libglib2.0-dev.  Failed to build in Lenny, but suspect that is
-solvable.  I hope kcov make it into Debian soon.&lt;/p&gt;
-
-&lt;p&gt;Finally found time to wrap up the release notes for &lt;a
-href=&quot;http://lists.debian.org/debian-edu-announce/2010/10/msg00002.html&quot;&gt;a
-new alpha release of Debian Edu&lt;/a&gt;, and just published the second
-alpha test release of the Squeeze based Debian Edu /
-&lt;a href=&quot;http://www.skolelinux.org/&quot;&gt;Skolelinux&lt;/a&gt;
-release.  Give it a try if you need a complete linux solution for your
-school, including central infrastructure server, workstations, thin
-client servers and diskless workstations.  A nice touch added
-yesterday is RDP support on the thin client servers, for windows
-clients to get a Linux desktop on request.&lt;/p&gt;
-</description>
-       </item>
-       
         </channel>
 </rss>