<br><br><div class="gmail_quote">On Thu, Nov 12, 2009 at 10:55 AM, Mr. Teo En Ming (Zhang Enming) <span dir="ltr">&lt;<a href="mailto:space.time.universe@gmail.com">space.time.universe@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Thu, Nov 12, 2009 at 10:45 AM, Bryn M. Reeves <span dir="ltr">&lt;<a href="mailto:bmr@redhat.com" target="_blank">bmr@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>On Thu, 2009-11-12 at 09:23 +0000, Mr. Teo En Ming (Zhang Enming) wrote:<br>
&gt; Hi All,<br>
&gt;<br>
&gt; I have several Xen virtual machines within logical volumes using LVM2.<br>
&gt; I did not use disk images for performance reasons.<br>
&gt;<br>
&gt; Conventionally, if I want to clone my virtual machines, I have to dd<br>
&gt; the LV to an image file. But this consumes a lot of time and harddisk<br>
&gt; space.<br>
&gt;<br>
&gt; So, instead of doing that, I want to use losetup and kpartx with my<br>
&gt; logical volumes, which contain operating systems of virtual machines.<br>
&gt;<br>
&gt; I can backup the filesystems of a virtual machine in this way:<br>
&gt;<br>
&gt; # losetup /dev/loop1 /dev/virtualmachines/windows7-x64<br>
<br>
</div>What&#39;s the point of adding a loopback device on top of the LV? Running<br>
kpartx on the LV itself will work just fine and this just adds an<br>
unnecessary layer of overhead and complexity unless I am missing<br>
something.<br>
<div><br>
&gt; dd if=/dev/hda of=mbr.hda bs=512 count=1<br>
&gt;<br>
&gt; Because /dev/hda resides in a logical volume. The logical volume is a<br>
&gt; virtual harddisk for my virtual machine.<br>
<br>
</div>Assuming that the LV given above is a whole-disk image containing a DOS<br>
MBR partition table:<br>
<br>
dd if=/dev/virtualmachines/windows7-x64 of=/tmp.mbr.img bs=512 count=1<br>
<br>
You could also do the same with the loopN device that you set up<br>
earlier, although I still don&#39;t see the need for that step.<br>
<div><br>
&gt; 1) re-create the physical volume (PV)<br>
&gt;<br>
&gt; 2) re-create the volume group<br>
&gt;<br>
&gt; 3) assign the PV to the volume group<br>
&gt;<br>
&gt; 4) restore the LVM metadata, i.e. the configuration files for all the<br>
&gt; logical volumes<br>
&gt;<br>
&gt; 5) restore the MBR of my domU<br>
&gt;<br>
&gt; 6) restore the filesystems of my domU<br>
<br>
</div>Should work fine, just be sure to test each step so that you are<br>
confident and comfortable with it before you find yourself needing to do<br>
this in anger.<br>
<br>
Regards,<br>
Bryn.<br>
<font color="#888888"><br>
<br>
--<br>
</font><div><div></div><div>fedora-list mailing list<br>
<a href="mailto:fedora-list@redhat.com" target="_blank">fedora-list@redhat.com</a><br>
To unsubscribe: <a href="https://www.redhat.com/mailman/listinfo/fedora-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-list</a><br>
Guidelines: <a href="http://fedoraproject.org/wiki/Communicate/MailingListGuidelines" target="_blank">http://fedoraproject.org/wiki/Communicate/MailingListGuidelines</a><br>
</div></div></blockquote></div><br></div></div>Hi Bryn,<br><br>I have just tried an experiment without the losetup step. I have verified that it works using kpartx only.<br><br>root@sysresccd /root % kpartx -av /dev/virtualmachines/winxphome32 <br>

add map virtualmachines-winxphome32p1 (253:22): 0 104840127 linear /dev/virtualmachines/winxphome32 63<br>root@sysresccd /root % cd /dev/mapper <br>root@sysresccd /dev/mapper % ls *winxphome32*<br>virtualmachines-winxphome32  virtualmachines-winxphome32p1<br>

root@sysresccd /dev/mapper % ls -al *winxphome32*<br>brw-rw---- 1 root disk 253,  0 2009-11-12 15:49 virtualmachines-winxphome32<br>brw-rw---- 1 root disk 253, 22 2009-11-12 18:47 virtualmachines-winxphome32p1<br>root@sysresccd /dev/mapper % ls -al *winxphome32*<br>

brw-rw---- 1 root disk 253,  0 2009-11-12 15:49 virtualmachines-winxphome32<br>brw-rw---- 1 root disk 253, 22 2009-11-12 18:47 virtualmachines-winxphome32p1<br>root@sysresccd /dev/mapper % fdisk -l virtualmachines-winxphome32<br>

<br>Disk virtualmachines-winxphome32: 53.7 GB, 53687091200 bytes<br>255 heads, 63 sectors/track, 6527 cylinders<div class="im"><br>Units = cylinders of 16065 * 512 = 8225280 bytes<br></div>Disk identifier: 0x2b362b35<div class="im">
<br><br>                       Device Boot      Start         End      Blocks   Id  System<br></div>
virtualmachines-winxphome32p1   *           1        6526    52420063+   7  HPFS/NTFS<br><br>Without the losetup and the corresponding overhead, it will speed up cloning of my virtual machines within LVs.<div><div></div>
<div class="h5"><br><br clear="all">
<br>-- <br>Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics) BEng(Hons)(Mechanical Engineering)<br>Alma Maters:<br>(1) Singapore Polytechnic<br>(2) National University of Singapore<br>My Primary Blog: <a href="http://teo-en-ming-aka-zhang-enming.blogspot.com" target="_blank">http://teo-en-ming-aka-zhang-enming.blogspot.com</a><br>

My Secondary Blog: <a href="http://enmingteo.wordpress.com" target="_blank">http://enmingteo.wordpress.com</a><br>My Youtube videos: <a href="http://www.youtube.com/user/enmingteo" target="_blank">http://www.youtube.com/user/enmingteo</a><br>
Email: <a href="mailto:space.time.universe@gmail.com" target="_blank">space.time.universe@gmail.com</a><br>
Mobile Phone (Starhub Prepaid): +65-8369-2618<br>Street: Bedok Reservoir Road<br>Country: Singapore<br>
</div></div></blockquote></div><br>Hi All,<br><br>I have performed a backup of my F11 Dom0&#39;s PV (60 GB) of 3 logical volumes using fsarchiver with the maximum possible LZMA compression. The operation took 4 hours with 2 compression threads. The resulting backup archive size is 8.1 GB for a PV of 60 GB.<br>
<br>My hardware specs:<br><br>Intel Pentium Dual Core E6300 2.8 GHz<br>Intel Desktop Board DQ45CB<br>6 GB DDR2-800 memory<br clear="all"><br>-- <br>Mr. Teo En Ming (Zhang Enming) Dip(Mechatronics) BEng(Hons)(Mechanical Engineering)<br>
Alma Maters:<br>(1) Singapore Polytechnic<br>(2) National University of Singapore<br>My Primary Blog: <a href="http://teo-en-ming-aka-zhang-enming.blogspot.com">http://teo-en-ming-aka-zhang-enming.blogspot.com</a><br>My Secondary Blog: <a href="http://enmingteo.wordpress.com">http://enmingteo.wordpress.com</a><br>
My Youtube videos: <a href="http://www.youtube.com/user/enmingteo">http://www.youtube.com/user/enmingteo</a><br>Email: <a href="mailto:space.time.universe@gmail.com">space.time.universe@gmail.com</a><br>Mobile Phone (Starhub Prepaid): +65-8369-2618<br>
Street: Bedok Reservoir Road<br>Country: Singapore<br>