Pick up and move to another computer easily: virtualize your current PC (individual partitions or whole disks)

October 8, 2009 37 Email article | Print article

Virtualization, or virtual machines, are very cool. For those that don’t know what I mean, here is a quick run down: Virtualization technology allows a user to “run an OS in an OS”; in other words, for example, you can have Windows XP 32-bit installed on your computer and run a virtualized version of Windows Vista 64-bit on top of that. The virtualized Windows Vista acts just like if it was installed on your physical machine. However you really didn’t install Windows Vista; you virtualized it and are running it in Windows XP just like you run any other program. Admittedly virtualization does require a fairly powerful PC (to give you a general idea, think of it as running two OSes on your computer at once) or else you will experience huge amounts of lag, but virtualization technology is one of those things that are just awesome.

Now to create a virtual machine, you need virtualization software. The three most popular ones out there VMware, VirtualBox, and Microsoft Virtual PC. VMware is more of a commercial product (although there are some server editions you can get for free), while VirtualBox and Microsoft Virtual PC are completely free. My favorite one has always been VirtualBox because it is open source, so available to all users, and is cross platform (works on Windows, Mac, and Linux).

That being said, being able to install a new OS on top of your current OS is nice and all, but the purpose of this post is not to go into the details of virtualization. Rather I would like to inform dotTechies of an awesome, and potentially very useful, trick: turn your current OS (with all your files and program) into a virtual machine so you can easily run it (with all your files and folders) on another PC. The best part is your current OS is left untouched; rather you just create a “virtual copy” of it. Think of it as creating a backup image of your computer but instead of restoring the image, you “run” the image with your favorite virtualization software such as VirtualBox.

You can turn your current OS into a virtual machine using two different programs: VMware vCenter Converter and Disk2vhd. After you virtualize your OS, you can run it using VMware, VirtualBox, or Microsoft Virtual PC.. For the purposes of this post, I will focus on a Disk2vhd + VirtualBox combination.

Disk2vhd…

2009-10-08_2219492

…allows you to easily virtualize your whole hard disk or select partitions. It is lightweight (707 KB download), portable, and [comparatively] fast (took me just under 40 minutes to virtualize the C:\ partition you see in the above screenshot) . You simply download Disk2vhd, unzip it (no installation required), run it, select the partitions you want to virtualize, click “Create”, and wait for it to finish. If you have multiple hard disks, Disk2vhd will create one VHD file for each hard disk.

The major advantage Disk2vhd has over rival create-virtual-images software is Disk2vhd takes advantage of Windows’ “Volume Snapshot” feature allowing you to virtualize the OS you are currently running whereas some other software will lock you out telling you they cannot create a virtual image of any online system.

After you have created a VHD for your OS, you can run the virtual machine on any computer you want via VirtualBox (of course make sure you copy the VHD file to the computer you want to run it on). Just download and install VirtualBox, create a new virtual machine on VirtualBox like you would normally, but make sure to select the VHD for the virtual hard drive instead of creating a new virtual hard drive:

2009-10-08_231456

2009-10-08_222408

2009-10-08_222423

2009-10-08_222429

2009-10-08_222515

2009-10-08_222525

2009-10-08_222541

2009-10-08_222606

After you create the virtual machine, simply run it, and let Windows install as many drivers as it can find. After that it is up to you to find the drivers yourself.

Of course since Disk2vhd creates a VHD, you can also use Microsoft Virtual PC to run the virtual machine instead of VirtualBox (do note, though, Virtual PC has a 127 GB virtual disk size limit). The only problem is Microsoft Virtual PC is only available to people who have Windows XP Pro, Windows Server 2003, Windows Vista Business or higher, Windows Server 2008, and Windows 7 Professional or higher.

Furthermore, if you have Windows XP, Windows Vista SP1, Windows Server 2008, or Windows 7 (regardless of which edition), you can “attach” your VHD and make Windows think it is a real physical partition on your hard drive so you can boot directly from it and not have to virtualize it with VirtualBox or Virtual PC. For XP/Vista you need to download the VHD mount from Virtual Server R2 while you can do it natively in Server 08/Win7.

All in all, this “turn-your-PC-into-a-virtual-machine” is very cool and can be potentially very useful. To get started yourself, download the appropriate software from the links below:

VMware Homepage

VirtualBox Homepage

Microsoft Virtual PC | Windows Virtual PC (Win 7 only)

Disk2vhd

VMware vCenter Converter

37 Comments »

  1. Rob October 12, 2009 at 8:12 PM (comment permalink) -

    Bill Gates II,

    Thanks for nice detailed answers.
    Much appreciated,
    Rob

    26
  2. jelson October 22, 2009 at 8:43 AM (comment permalink) -

    Thank you so much for the article. I’ve been interested in virtualization for quite awhile but had thought that expensive VMware was my only option!

    Virtual Box here I come. Yahoo!

    27
  3. Rob October 22, 2009 at 9:17 AM (comment permalink) -

    I have been awaiting the latest release of Ubuntu, which I will use as a host for VirtualBox, and then run XP virtually.
    If anyone is interested, here is a detailed ‘How To’ -
    http://apcmag.com/how_to_virtualize_xp_on_ubuntu.htm

    And I just tripped over this -
    http://ubuntuforums.org/showthread.php?t=183209
    which I have not checked out yet

    28
  4. PTLdom November 7, 2009 at 7:46 PM (comment permalink) -

    Ashraf,

    Unfortunately the copy of my entire HD in the format VHD made with disk2vhd was considered as … no bootable by virtual box :( … any sugestions?

    29
  5. PTLdom November 9, 2009 at 7:55 AM (comment permalink) -

    Pssssttt … Ashraf, are you there? Help, please?

    30
  6. Daniel March 22, 2010 at 2:33 PM (comment permalink) -

    RE: Booting into the virtual drive.

    Are there any instructions around regarding what would have to be added to the BOOT.INI in order for Virtualization software to mount the virtual drive and boot from it?

    I’m planning on trying this with the vhdmount component of the Virtual Server 2005 R2 (ala http://www.tech-recipes.com/rx/3595/windows-xpvista-how-to-attach-a-vhd-file/), but am uncertain how to proceed.

    Or, is this idea of booting from a virtual drive something that someone’s heard about, but nobody has successfully accomplished?

    BTW, Ashraf, thanks for the excellent help, and the thorough analysis you often give for the GiveAwayOfTheDay offerings. I may not download the offerings, but I always check what you have to say, if for no reason other than to see what freeware options are out there that are comparable.

    31
  7. SURESH June 24, 2010 at 5:48 AM (comment permalink) -

    I was searching as to how to craete a virtual machine and this gives me an insght aboutthe actual details,
    I have one question, ashraf, and it is unusual, can I create a virtual on of a Mac and than run it on XP pro, is it possible ?

    32
  8. Samuel June 24, 2010 at 7:09 AM (comment permalink) -

    @SURESH: Thats very far from unusual because not only can you but a lot of people with Macs run Windows in a VM. I don’t know if VirtualBox runs on Mac but I do know that for Mac one can use either Parallels Desktop from Parallels or you can use VMWare’s Mac VM (don’t know what it’s called).

    33
  9. SURESH June 27, 2010 at 4:57 AM (comment permalink) -

    Thanks samuel,
     
    How about the otherway round; putting MaC OS in VM and running on Win XP: I cam acroos some you tube viedois but couldn’t get the hang about putting the Mac OS in a VM .
    Could you give me some guidance, I need to run an application which is available only for MAC: and how to create an iso of MAC OS running on mac-laptop .

    34
  10. Samuel June 27, 2010 at 6:19 AM (comment permalink) -

    @SURESH: First things first: Running Mac OS on ANY machine that is not made by Apple is considered Illegal according to Apple and the courts have for the most part backed them up. As such while I know it can be done, I will not say how to do it.

    As far as the problem of running a Mac only program, what program is it? I’m sure there is another program out there that can do the same stuff but will run on Windows.

    Being as an ISO is an image of a Optical Disk (CD/DVD/Blue-Ray) I’m going to guess you mean you want to clone the hard drive like Disk2Vhd can. Your best method would be to try to use a Backup program that creates images for you. Don’t know of any that are meant for Macs though.

    35
  11. SURESH June 28, 2010 at 8:40 AM (comment permalink) -

    Samuel,
    Thanks
    the programme that I am interested is Scrivener, a very specific one normally used by writers, and the purpose is that I want to write some long /articles’booklets: if you know of the same functionality anf the programme is for XP it would be great

    36
  12. Samuel June 28, 2010 at 11:21 AM (comment permalink) -

    @SURESH: While I’m not positive it sounds like ever thing it can do you can do in Word 2007 or 2010.

    37

Leave A Response »