WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

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

To: Xen Users Mailing List <xen-users@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-users] Can you convert Windows LVM domU to sparse img file?
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <9DD85BCC-83E1-4349-9A88-A31DDA6A6439@xxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <1231982574.7185.11.camel@xxxxxxxxxxxxxxxxxxxxxxxx> <496EDED7.70201@xxxxxxxx> <496EF093.8090605@xxxxxxxxx> <9DD85BCC-83E1-4349-9A88-A31DDA6A6439@xxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.18 (X11/20081125)
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