I looked at some images in /var/lib/xen/images/ and since they have partition tables and look, to me, just like disks, I copied part of my hard disk to /var/lib/xen/images/WindowsXP.img
The reason is that I want to try the Windows XP that came preinstalled, and copying /dev/sda for a length I calculated includes the entire /dev/sda1 partition seems a likely way to test it. These are the commands: dd if=/dev/sda of=/var/lib/xen/images/WindowsXP.img count=76597082 dd of=/var/lib/xen/images/WindowsXP.img seek=320072933376 bs=1 count=0
the second makes the disk image seem to be the proper size.
I tried to start it like so: qemu-kvm -boot c -snapshot -m 256 -smp 2 -std-vga \ /var/lib/xen/images/WindowsXP.img
and it choked:
[root@potoroo ~]# qemu-kvm -boot c -snapshot -m 256 -smp 2 -std-vga /var/lib/xen/images/WindowsXP.img vram_pointer=0x2aaac0b5d000 exception 0 (0) rax 0000000000000022 rbx 0000000000007000 rcx 000000000064e165 rdx 0000000000000100 rsi 00000000ffff7c05 rdi 000000000008ffea rsp 0000000000001ffe rbp 0000000000000000 r8 0000000000000000 r9 0000000000000000 r10 0000000000000000 r11 0000000000000000 r12 0000000000000000 r13 0000000000000000 r14 0000000000000000 r15 0000000000000000 rip 000000000000fce2 rflags 00033206 cs 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) ds 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) es 0800 (00008000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) ss 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) fs 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) gs 0000 (00000000/0000ffff p 1 dpl 3 db 0 s 1 type 3 l 0 g 0 avl 0) tr 0000 (10850000/00002088 p 1 dpl 0 db 0 s 0 type b l 0 g 0 avl 0) ldt 0000 (00000000/0000ffff p 1 dpl 0 db 0 s 0 type 2 l 0 g 0 avl 0) gdt fad00/30 idt 0/3ff cr0 60000010 cr2 0 cr3 0 cr4 0 cr8 0 efer 0 code: d5 03 e4 fc 24 44 d5 03 3e 00 d4 03 00 c0 f8 01 00 00 d5 03 --> f6 fc 24 44 d5 03 3f 00 d4 03 00 c0 f8 01 00 00 d5 03 08 fd 24 44 d5 03 40 00 d4 03 00 c0 Aborted [root@potoroo ~]#
Here is the source disk: Disk /dev/sda: 320.0 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xd42ad42a
Device Boot Start End Blocks Id System /dev/sda1 * 1 8669 69633711 7 HPFS/NTFS /dev/sda2 8671 9715 8393962+ 7 HPFS/NTFS /dev/sda3 9716 9728 104422+ 72 Unknown /dev/sda4 9729 38913 234428512+ 5 Extended /dev/sda5 9729 9741 104391 83 Linux /dev/sda6 9742 38913 234324058+ 8e Linux LVM [root@potoroo ~]#
Partitions 2 and up are unimportant.
fdisk on the disk image reports: Command (m for help): p
Disk /var/lib/xen/images/WindowsXP.img: 0 MB, 0 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xd42ad42a
Device Boot Start End Blocks Id System /var/lib/xen/images/WindowsXP.img1 * 1 8669 69633711 7 HPFS/NTFS /var/lib/xen/images/WindowsXP.img2 8671 9715 8393962+ 7 HPFS/NTFS /var/lib/xen/images/WindowsXP.img3 9716 9728 104422+ 72 Unknown /var/lib/xen/images/WindowsXP.img4 9729 38913 234428512+ 5 Extended
Command (m for help): q
but I had to specify the number of cylinder, 38913 but qemu-kvm rejects that nonsense.
Is there a better way to do this? I really want to test running this Windows under Linux before allowing it to use the real disk.