<?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>Tech Trivia &#187; LVM</title>
	<atom:link href="http://www.alethe.com/brad/tag/lvm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alethe.com/brad</link>
	<description>For those who know just enough to be dangerous</description>
	<lastBuildDate>Sun, 28 Feb 2010 04:45:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Move an LVM-based virtual machine to another host</title>
		<link>http://www.alethe.com/brad/2008/04/move-an-lvm-based-virtual-machine-to-another-host/</link>
		<comments>http://www.alethe.com/brad/2008/04/move-an-lvm-based-virtual-machine-to-another-host/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 03:18:26 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tech Notes]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[LVM]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://www.alethe.com/brad/?p=35</guid>
		<description><![CDATA[For those running Xen on servers with no back-end SAN, the following instructions detail the steps necessary to move an LVM-based virtual machine to a new physical host. There may be more elegant ways to achieve this, but this is what worked for me. Environment Ok, so let&#8217;s set the scene: vmhost is a RHEL [...]]]></description>
			<content:encoded><![CDATA[<p>For those running Xen on servers with no back-end SAN, the following instructions detail the steps necessary to move an LVM-based virtual machine to a new physical host.  There may be more elegant ways to achieve this, but this is what worked for me.</p>
<p><strong>Environment</strong><br />
Ok, so let&#8217;s set the scene:</p>
<ul>
<li><code>vmhost</code> is a RHEL 5 server running several virtual machines using the Xen virtualization technology. Each virtual machine is allocated a 60 GB logical volume within an LVM volume group. One of these virtual machines, &#8220;win2k3vm&#8221;, needs to be moved to a new server.</li>
<li><code>new-vmhost</code> is almost identical to vmhost, but has updated hardware and more memory.  This is the server that &#8220;win2k3vm&#8221; will be moved to.</li>
</ul>
<p><span id="more-35"></span><br />
<strong>Migrate the Virtual Machine</strong><br />
1. Create a snapshot of virtual machine LVM volume.  This can be run on a live virtual machine, but it is probably safer to perform a graceful shutdown of your virtual machine first.</p>
<p><code>[root@vmhost]# lvcreate -s -L 300m -n win2k3vm-snap VolGroup01</code></p>
<p>2. Export the snapshot of the guest VM to a file that can be moved between physical servers.</p>
<p><code>[root@vmhost]# dd if=/dev/VolGroup01/win2k3vm-snap of=/mnt/temp/win2k3vm.img bs=4096</code></p>
<p>3. Remove the snapshot LVM volume.</p>
<p><code>[root@vmhost]# lvremove /dev/VolGroup01/win2k3vm-snap</code></p>
<p>4. Copy the file to the new VM host.  Make sure you have sufficient free drive space.</p>
<p><code>[root@vmhost]# scp /mnt/temp/win2k3vm.img user@new-vmhost:/mnt/temp/</code></p>
<p>5. On the new VM host, create an LVM volume that is at least as big as the guest VM file.</p>
<p><code>[root@new-vmhost]# lvcreate -n win2k3vm -L 60G VMGroup</code></p>
<p>6. Transfer the guest VM file to the new LVM volume.</p>
<p><code>[root@new-vmhost]# dd if=win2k3vm.img of=/dev/VMGroup/win2k3vm bs=4096</code></p>
<p>7. Copy the VM config file from the old VM host to the new VM host server.</p>
<p><code>[root@vmhost]# scp /etc/xen/win2k3vm user@new-vmhost:</code></p>
<p>8. Copy the file to the appropriate directory.</p>
<p><code>[usr@new-vmhost]$ sudo mv ~/win2k3vm /etc/xen/</code></p>
<p><strong>Summary of Commands</strong><br />
<code>[root@vmhost]# lvcreate -s -L 300m -n win2k3vm-snap VolGroup01<br />
[root@vmhost]# dd if=/dev/VolGroup01/win2k3vm-snap of=/mnt/temp/win2k3vm.img bs=4096<br />
[root@vmhost]# lvremove /dev/VolGroup01/win2k3vm-snap<br />
[root@vmhost]# scp /mnt/temp/win2k3vm.img user@new-vmhost:/mnt/temp/<br />
[root@new-vmhost]# lvcreate -n win2k3vm -L 60G VMGroup<br />
[root@new-vmhost]# dd if=win2k3vm.img of=/dev/VMGroup/win2k3vm bs=4096<br />
[root@vmhost]# scp /etc/xen/win2k3vm user@new-vmhost:<br />
[usr@new-vmhost]$ sudo mv ~/win2k3vm /etc/xen/<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alethe.com/brad/2008/04/move-an-lvm-based-virtual-machine-to-another-host/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
