I just revived a #windowsxp
installation using #linux #kvm
! The laptop's motherboard died 4 years ago and the OS on it hadn't been booted since, even though I would still use the drive externally on occasion.
Since the hard drive is dying, I used ddrescue since regular dd stopped after a read failure. These are the commands I used on KVM under CentOS 7:
0) Run "lsblk" to discover which hard drive you want to copy, assuming you can differentiate between them in this manner. In this example, I found that sdc was the drive I wanted to image.
1) Copy the entire
hard drive to a raw .img file using ddrescue:
ddrescue -v -f -n /dev/sdc /vms/XPDRIVE.img dd_XPDRIVE.log
2) Make sure to recover additional bad blocks by skipping the buffer & attempting to read directly from hardware:
ddrescue -d -f -r3 /dev/sdc /vms/XPDRIVE.img dd_XPDRIVE.log
3) Convert the raw image to qcow2 (theoretically you could stick with raw for better performance, but qcow2 adds some reliability features):
qemu-img convert -f raw /vms/XPDRIVE.img -O qcow2 /vms/XPDRIVE.qcow2
4) Download the ISO of Hiren's Boot CD, and then execute this virt-install command to launch a VM with VNC enabled that will start up with Hiren's image while allowing you to work on fixing issues with the XP installation:
sudo virt-install --connect qemu:///system --name XPSYSTEM --hvm --ram 4096 --disk path=/vms/XPDRIVE.qcow2,format=qcow2,bus=ide --network bridge:br0 --graphics vnc --os-variant winxp --arch i386 --cdrom /vms/Hiren\'s.BootCD.15.2.iso --boot=cdrom,menu=on
* This step assumes you have already created a network bridge called br0 that allows your VMs to share the host's Internet connection.
5 - ε) To avoid problems with your mouse, make the remote server deal with the cursor (in TightVNC, select "Options" -> "Let remote server deal with cursor").
If you try to boot the XP VM at this point, you will likely get a 0x7B stop error. The next step will help you avoid this.
5) In Hiren's Boot, load "Mini Windows Xp". Once it comes up, go to "Start" -> "HBCD Menu". Then when that launches, go to "Programs" -> "Registry" -> "Fix hard disk controller (fix_hdc.cmd)". In the Terminal, first press T to set the Target Root (i.e. your main Windows directory), then press M to let the magic happen.
6) Navigate to the Start menu to restart your VM. It should reboot into your freshened XP installation!
P.S. Anyone want a 100GB laptop IDE hard drive with a coupla bad blocks?