Wow, I seriously misread the e-mails when I responded yesterday,
thinking "format" in place of "fdisk" and "MFT" in place of "MBR." The sad
thing is, I just did this a week ago, and had to go back and mark the partition
active because I had forgotten and couldn't boot, yet when responding, thinking
it was still all fresh in my mind, it wasn't. That said, James, congrats on
doing the sparse file the way you wanted to. Anyone else following this
thread, Fajar's information below is as or more important than the information
I provided yesterday. Finally, Fajar, you should be able to use the final
cylinder without Windows BSODing, I do it all of the time, sometimes by
partitioning prior to installation and other times by cloning. I am guessing
the problem causing your BSOD was that the NTFS MFT indicated a different size
than the partition. In that case, an ntfsresize would have fixed it as well,
not that the extra 8MB matters.
Dustin
-----Original Message-----
From: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
[mailto:xen-users-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Fajar A. Nugraha
Sent: Thursday, January 15, 2009 22:00
To: Xen Users Mailing List
Subject: Re: [Xen-users] Can you convert Windows LVM domU to sparse img file?
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
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
|