为了看看是否可以做到(如果可以,将其他物理 XP 机器移至 VM 环境),我从一台退役的笔记本电脑中取出硬盘,捕获了它的 WIM,并将其应用到 QCOW2 磁盘。它无法启动。它停留在“从硬盘启动...”状态。我已经看到了此链接。该行为是我所看到的,但解决方案中有针对该 VM 已设置的建议,并且该机器作为我捕获的物理机器启动,而不是转换后的 Hypervisor 机器。
源驱动器装有 Windows XP。WIM 是在 Windows 上使用 gimagex(imagex 的 GUI 前端)捕获的。我在现有的 Ubuntu Server 18 KVM 机器(“US18”)中安装了 wimtools。关闭“US18”后,我向其中添加了一个新的 40 GB QCOW2 磁盘,启动它,使用fdisk
(分区类型 7)对磁盘进行分区,将分区标记为活动分区,并格式化为 NTFS。
我曾经wimverify
验证过 WIM(效果很好)。我曾经将wimapply WinXP.wim /dev/vdb1
捕获的 WIM 应用于虚拟磁盘。效果很好。
我已将 CPU 数量和内存设置为 XP 时代适当的数量和大小。它未设置为使用 UEFI 启动。它使用“BIOS”和“i440FX”。它停留在标题为“正在启动...”的消息上。
我已经尽我所能了。我宁愿迁移现有机器,而不是重新安装 XP,然后将程序等移至 VM。
我已将 vdisk 的“总线类型”更改为 IDE 和 SATA,但没有任何效果。
有人可以给我一些指点吗?
以下是准备磁盘和应用 WIMage 的完整步骤。
root@US18 <01>:~# ls -l /dev/disk/by-path
total 0
lrwxrwxrwx 1 root root 9 Nov 23 17:19 pci-0000:00:01.1-ata-1 -> ../../sr0
lrwxrwxrwx 1 root root 9 Nov 23 17:19 pci-0000:00:07.0 -> ../../vda
lrwxrwxrwx 1 root root 10 Nov 23 17:19 pci-0000:00:07.0-part1 -> ../../vda1
lrwxrwxrwx 1 root root 10 Nov 23 17:19 pci-0000:00:07.0-part2 -> ../../vda2
lrwxrwxrwx 1 root root 9 Nov 23 17:19 pci-0000:00:09.0 -> ../../vdb
lrwxrwxrwx 1 root root 9 Nov 23 17:19 virtio-pci-0000:00:07.0 -> ../../vda
lrwxrwxrwx 1 root root 10 Nov 23 17:19 virtio-pci-0000:00:07.0-part1 -> ../../vda1
lrwxrwxrwx 1 root root 10 Nov 23 17:19 virtio-pci-0000:00:07.0-part2 -> ../../vda2
lrwxrwxrwx 1 root root 9 Nov 23 17:19 virtio-pci-0000:00:09.0 -> ../../vdb
root@US18 <02>:~# fdisk -l /dev/vdb
Disk /dev/vdb: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@US18 <03>:~# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xefae0542.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-62914559, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-62914559, default 62914559):
Created a new partition 1 of type 'Linux' and of size 30 GiB.
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 7
Changed type of partition 'Linux' to 'HPFS/NTFS/exFAT'.
Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.
Command (m for help): p
Disk /dev/vdb: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xefae0542
Device Boot Start End Sectors Size Id Type
/dev/vdb1 * 2048 62914559 62912512 30G 7 HPFS/NTFS/exFAT
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@US18 <04>:~# mkfs.ntfs -f /dev/vdb1
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
root@US18 <05>:~# wimapply WinXP.wim /dev/vdb1 --check
Verifying integrity of "/root/WinXP.wim": 9 GiB of 9 GiB (100%) done
Applying image 1 ("WIM1") from "/root/WinXP.wim" to NTFS volume "/dev/vdb1"
Creating files: 72106 of 72106 (100%) done
Extracting file data: 17 GiB of 17 GiB (100%) done
Done applying WIM image.
root@US18 <06>:~# mount /dev/vdb1 /mnt/
root@US18 <07>:~# ls -lh /mnt
total 5.1M
drwxrwxrwx 1 root root 0 Feb 12 2013 1a065bae91d7da681f18ce
-rwxrwxrwx 1 root root 0 Feb 10 2013 AUTOEXEC.BAT
-rwxrwxrwx 1 root root 211 Feb 19 2013 boot.ini
-rwxrwxrwx 1 root root 86 Feb 12 2013 chicony.log
-rwxrwxrwx 1 root root 0 Feb 10 2013 CONFIG.SYS
drwxrwxrwx 1 root root 4.0K Feb 19 2013 'Documents and Settings'
...
drwxrwxrwx 1 root root 24K Nov 21 22:32 temp
drwxrwxrwx 1 root root 256K Feb 27 2018 WINDOWS
-rwxrwxrwx 1 root root 956K Jul 6 2011 Xtension
root@US18 <08>:~# umount /mnt