How to migrate existing Windows installations to VirtualBox

Discussions about using Windows guests in VirtualBox.
Post Reply
BartEend
Posts: 2
Joined: 29. Aug 2012, 11:29

How to migrate existing Windows installations to VirtualBox

Post by BartEend »

I've got a question about the "How to migrate existing Windows installations to VirtualBox" tutorial on the VirtualBox website.

In short the question is: How to create an image of my Windows installation?

But since this forum doesn't allow me to post my question with the message "You must be a member for 1 days and have 1 posts before you can post urls" even though I've got 0 urls in my post... :shock: ...I just post a message now, so I'm hopefully allowed to post my full question tomorrow.... :roll:

Stay tuned :wink:
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How to migrate existing Windows installations to Virtual

Post by mpack »

I'm assuming you have a Windows host in addition to a Windows guest - in which case Google "Disk2VHD site:forums.virtualbox.org".
BartEend
Posts: 2
Joined: 29. Aug 2012, 11:29

Re: How to migrate existing Windows installations to Virtual

Post by BartEend »

Hello mpack, thanks for your fast reply. No, I don't have a Windows Host, but a Linux (Kubuntu) host. Here's my full question:

I've got a question about the "How to migrate existing Windows installations to VirtualBox" tutorial on the VirtualBox website: https://www.virtualbox.org/wiki/Migrate_Windows

In short the question is: How to create an image of my Windows installation?

Here follows the long version of my question :wink::

My situation:
I've got a laptop with a brand new Windows 7 installation. Actually, I never ever booted it. I added a Solid State Disk to my laptop, installed Kubuntu on it and since then I worked from Kubuntu.
Now I've got to use Windows for a special application. But I don't want to reboot my laptop every time I need to use that application. Since I've got a Windows 7 license, I want to use that for a Windows 7 VirtualBox Virtual Machine running op my Kubuntu host.

I found two helpfull howto's on how to do this: The HowTo's say I have to convert the drive with the Windows installation to a .vdi file.


My problem:
The drive with the Windows 7 installation is very large (750 GB). I don't have another drive with that much space left. So I can't create an image that is as large as the drive where the Windows 7 installation stands on. Instead I want to create an image that is not much larger than the actual Windows 7 installation (approximately 40 GB).


My questions:
1. How can I create a .vdi of my Windows 7 installation that is not as large as the whole drive Windows 7 is installed on, but approximately as large as the Windows 7 installation (Which is spread over two partitions according to Jason L. Froebe: "make sure you specify the entire drive (i.e. /dev/sdh) and not individual partitions else you will miss the hidden partitions that Vista and Windows 7 create")

2. If my understanding that the dd command will result in a file that is as large as the complete drive is wrong, but dd actually only creates a file that is as large as the data in all the partitions on the drive, then I've got the following question:
2a. How do I create an image with the dd command?
The "How to migrate existing Windows installations to VirtualBox" tutorial says: "copy the data with a low level image tool (like dd) to a USB drive or other removable media. If making an image, DO NOT image just the partition, this will not work!" But it doesn's say how to do that with dd. Is it just: cat /dev/sda | dd of=OutputFile.dd ?
2b. Which other low level image tool can you recommend me?


Additional details:
The output of fdisk -l is:

Code: Select all

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xa383324b

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    52430847    26214400   1c  Hidden W95 FAT32 (LBA)
/dev/sda2   *    52430848   693467135   320518144    7  HPFS/NTFS/exFAT
/dev/sda3       693467136  1465147391   385840128    7  HPFS/NTFS/exFAT

(...)
/dev/sda1 is probably that hidden partition that Jason L. Froebe wrote about. (I first assumed it was only a recovery partition....)
/dev/sda2 contains my Windows 7 installation (as you might have guesed, because it's the boot partition :wink:)
/dev/sda3 is empty at the moment.


Host: Kubuntu 11.10, the Oneiric Ocelot release
VirtualBox: 4.1.2_Ubuntur38459
Guest: I want to migrate the Windows 7 installation on an Asus N73S laptop to a guest.
I don’t have a Windows 7 installation disk.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How to migrate existing Windows installations to Virtual

Post by mpack »

Actually my answer is the same as before - run Disk2VHD on the existing Windows installation, making sure to select the entire disk, not just a single partition. Be aware that a Win7 guest will ask to be reactivated when it sees such a radical hardware change (physical to virtual). Activating the VM will mean that you must stop using the physical installation or risk the wrath of MS (and yes, they have spies everywhere).

Although Disk2VHD is a convenient tool I would not recommend using the resulting VHD. I would use CloneVDI or VBoxManage to convert to VDI first, then I would build a VM around the VDI. Try to get the VM recipe close to that of the original PC.
Post Reply