Page 1 of 1

How to create disk image (with dd) for Windows migration

Posted: 13. Jul 2011, 20:43
by Zajec
According to howto:
http://www.virtualbox.org/wiki/Migrate_Windows
I need to create some special image of existing Windows when migrating into Virtualbox.

Could someone explain "DO NOT image just the partition" to me, please? I wanted to use:
dd if=/dev/sda1 of=/mnt/usb/xp.dd
but AFAIU this would be image of partition. Howto says to don't do that.

What am I expected to do? Something like:
dd if=/dev/sda of=/mnt/usb/xp.dd
does not make much sense to me.

Moreover trying this command resulted in:

# dd if=/dev/sda of=/mnt/usb/xp.dd
dd: reading `/dev/sda`: Input/output error
53521584+0 records in
53521584+0 records out
27403051008 bytes (27 GB) copied, 5137.74 s., 5.3 MB/s

[18631.401296] ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[18631.401305] ata1.00: BMDMA stat 0x65
[18631.401313] ata1.00: failed command: READ DMA
[18631.401330] ata1.00: cmd c8/00:00:a0:ac:30/00:00:00:00:00/e3 tag 0 dma 131072 in
[18631.401334] res 51/40:e9:b7:ac:30/00:00:00:00:00/e3 Emask 0x9 (media error)
[18631.401342] ata1.00: status: { DRDY ERR }
[18631.401347] ata1.00: error: { UNC }
[18631.464318] ata1.00: configured for UDMA/100
[18631.480463] ata1.01: configured for MWDMA2
[18631.480483] ata1: EH complete
(...)

Re: How to create disk image (with dd) for Windows migration

Posted: 13. Jul 2011, 21:44
by Sasquatch
The use of 'dd if=/dev/sda of=/mnt/whatever/file.dd' and failing would mean that you try to create a dd output of the drive that's currently in use. This would be with a dual boot on the same hard drive. The howto means that if you only pick the partition, you won't get a bootable system because the MBR is missing. The MBR is in the first 512 bytes of the hard drive and is not captured when you take the partition only. You can still get the partition image, but you would require a boot repair after you restore it as a VM.
If you use a tool like CloneZilla, you could make an image of the partition and restore it inside a VDI. You can also restore the dd output to a VDI if you boot the VM with a Linux live CD first and access the image through a shared storage system (USB or direct network share). Then you still have to restore the MBR link to the OS. Should work nonetheless.
The howto wants to avoid this 'problem'.

Re: How to create disk image (with dd) for Windows migration

Posted: 14. Jul 2011, 12:02
by mpack
Alternatively, CloneVDI has an internal solution for precisely this problem. Go ahead and create your image of an XP partition. Make sure the file has the ".raw" extension, then clone the .raw file using CloneVDI (select the "compact" option to reduce the clone size). CloneVDI will notice that its a partition image and will automatically fill in the missing MBR and track 0, creating a valid bootable VDI.

For CloneVDI see the download link in the sticky in "Windows Hosts" forum. You will need Wine if you want to run it on a Linux host.

Re: How to create disk image (with dd) for Windows migration

Posted: 14. Jul 2011, 13:56
by Zajec
Sasquatch wrote:The use of 'dd if=/dev/sda of=/mnt/whatever/file.dd' and failing would mean that you try to create a dd output of the drive that's currently in use. This would be with a dual boot on the same hard drive.
This is not the case. I use /dev/sdb1 as /mnt/usb/. It's totally different disk (external one, connected by usb). The source of my problems seem to be dying hard drive :(
Sasquatch wrote:The howto means that if you only pick the partition, you won't get a bootable system because the MBR is missing. The MBR is in the first 512 bytes of the hard drive and is not captured when you take the partition only. You can still get the partition image, but you would require a boot repair after you restore it as a VM.
Thanks! I'll probably just try fixmbr/fixboot from Windows rescue console.
Sasquatch wrote:If you use a tool like CloneZilla, you could make an image of the partition and restore it inside a VDI. You can also restore the dd output to a VDI if you boot the VM with a Linux live CD first and access the image through a shared storage system (USB or direct network share). Then you still have to restore the MBR link to the OS. Should work nonetheless.
The howto wants to avoid this 'problem'.
Thanks, I'm trying dd_rescue right now. It this won't help, I'll switch to CloneZilla and give it a chance.

Is there a way I can edit wiki page? I registered on wiki, but can not see the "Edit" link/button. I wanted to improve this entry, make the description more detailed.

Re: How to create disk image (with dd) for Windows migration

Posted: 14. Jul 2011, 21:48
by Sasquatch
We don't have access to the wiki. We used to have a full wiki running on MediaWiki software, but after we got some info on it, nothing came from it, so it died. All that's left is the tutorial section here on the forums. You're free to create your own tutorial if you want, so we can put it there.
Zajec wrote:This is not the case. I use /dev/sdb1 as /mnt/usb/. It's totally different disk (external one, connected by usb). The source of my problems seem to be dying hard drive :(
So you're saying you're not trying to image the hard drive that you're using for Linux itself? It's not mounted somewhere either? If you have a dying hard drive, then you would at least hear some strange noises from it and it's S.M.A.R.T. status would show failing or something like that. Smartmontools in Linux allows you to read this data.