[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Can you convert Windows LVM domU to sparse img file?


  • To: Xen Users Mailing List <xen-users@xxxxxxxxxxxxxxxxxxx>
  • From: "Fajar A. Nugraha" <fajar@xxxxxxxxx>
  • Date: Fri, 16 Jan 2009 10:00:25 +0700
  • Delivery-date: Thu, 15 Jan 2009 19:01:19 -0800
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

Ross Walker wrote:
> On Jan 15, 2009, at 3:15 AM, "Fajar A. Nugraha" <fajar@xxxxxxxxx> wrote:
>> An alternative would be to use ntfsresize and ntfsclone, but it requires
>> a lot more effort (including using kpartx,fdisk, and having a "good" MBR
>> handy).
>
I wrote "a lot more effort" because it does, indeed, require a lot more
effort. I did something similar actually (cloning Windows on an LV to
another LV).

> 1) create a sparse file the size needed
>
> 2) add it as a loop device
>
> 3) fdisk the loop device
>
During fdisk, there are some caveats :
- make SURE partition 1 (or whatever your windows partition will be) is
set active
- set the type to 7 (NTFS)

In my case I also had make sure that the last cylinder is unused.
For example, if you create 10G LV (or disk image), and fdisk shows 1035
cylinders, partition 1 can only occupy cylinder 1-1034 (This is what you
get if you install windows from CD on that LV). Linux's fdisk let you
use cylinder 1-1035, but if you do this Windows will BSOD. Took me
several hours to figure this out by comparing original and cloned machine.

After this, you need two more steps :
- get a good MBR, copy it with dd. I used the one from syslinux
(/usr/share/syslinux/mbr.bin)
- create dev mappings for the partition using kpartx (something like
kpartx -av /dev/loop0). It will be in /dev/mapper/loop0p1 (or something
similar). Do this for both the LV and the loop device.

> 4) ntfsclone the lv to the loop device.
>

Regards,

Fajar

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.