Run Your Windows With VMware

If you already have a Windows PC, you can install Linux and run your existing Windows configuration as a virtual machine. Jason Perlow explains how to do it.

For many Linux users, VMware has become an indispensable tool. While excellent emulation solutions, such as Wine and CrossOver Office can run selected mainstream Windows applications directly on top of Linux without virtualization or actual Windows code, only virtualization can provide perfect Windows compatibility. VMware makes the desktop computing experience complete.

However, virtual machine images of full operating system installs take up considerable hard drive space and consume more memory than emulation. And what’s hardest to swallow is having to re-install Windows (or the virtualized operating system of choice) and supplemental applications in the virtual machine. If you’ve been using a particular operating system instance for any length of time, chances are you have a legion of files, preferences, and software you want to keep. Moreover, you may not have your original install media, or you may prefer to retain a specific version of an application rather than upgrade. You may even want to dual-boot to your existing Windows install because it has games or other packages that donÕt work as well when virtualized.

Well, little did I know that the free, end-user VMware products — VMware Player and VMware Server — can run your existing, on-the-metal Windows configuration virtualized within Linux using a technology that’s really only known to users of VMware’s enterprise product, ESX Server, a part of their Virtual Infrastructure 3 suite. The technology, known as RAW Device Mapping (RDM), is a virtualized SCSI device compatibility mode that enables a virtual machine to boot from a physical disk (or partition) rather than a virtual disk file. This capability has been around for a long time, but VMware has never really advertised it, and hasn’t provided any wizard-like capability in VMware Player or Server to easily take advantage of it.

Here, I’m going to show you how to use it.

Creating a New Hardware Profile in Windows

Before you can virtualize your Windows XP system, add a new hardware profile so that when your existing Windows install boots up within VMware Player, its hardware profile isnÕt overwritten or corrupted by the newer, paravirtualized drivers. This way, you’ll still be able to use your existing Windows configuration on the metal if you have to.

To create a new hardware profile, boot your Windows XP system, open the Control Panel (Start Button > Settings > Control Panel), double click on System, and click on the Hardware tab. Next, click on Hardware Profiles, as depicted in Figure One. Copy the default profile to a new name, such as VMware.

FIGURE ONE: The System Properties Hardware Profile screen in the Windows XP Control Panel

Optionally, set the “Hardware Profiles Selection” to a timeout value you’re comfortable with (perhaps 30 seconds), or set it to “Wait until I select a hardware profile.” This setting controls the Hardware Profile selection screen when Windows XP first boots. By default, screen this doesn’t come up on most PCs, but since you’re adding a new hardware profile to the system, you’re going to get one from now on.

Remember, you never want to boot into your default profile during a virtualized session. Make sure you have enough time to select the VMware profile you just added.

Making Room On Your Disk for Linux

Presumably, you’ve got a PC that already dual-boots Linux and Windows, so if you do, you can skip this section entirely. If youÕve got a PC that runs Windows but doesnÕt have Linux installed, youÕre going to need to install Linux.

The easiest way to to proceed is buy a secondary hard disk, install it in your PC, and then install Linux on that new disk along with the GRUB boot loader to provide dual-boot capability. However, if you own a laptop, or have a huge hard drive with a lot of free space left, you might not be able to add a second hard disk or feel thereÕs no need to do so. In those instances, you must teclaim that unused hard drive space back to install Linux.

In the May 2007 “On The Desktop” column, I wrote about the System Rescue CD, a bootable, free CD distro designed specifically for system rescue and repair scenarios. Among the many tools you can use on that CD is ntfsresize, which enables you to reclaim unused disk sectors from a Windows NTFS filesystem and use it as free space in order to create a new partition.

Before you actually perform the resize, gather some important information. Boot with the System Rescue CD, and from the Linux bash prompt, issue the following command:

root@sysresccd /root% parted

You should get the following prompt:

GNU Parted 1.7.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.

At the prompt, issue this command:

(parted) print free                                                      

Disk /dev/sda: 100GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

You should then get output similar to the following:

Number  Start   End     Size    Type      File system  Flags
        32.3kB  32.9MB  32.9MB            Free Space
 2      32.9MB  52.9GB  52.8GB  primary   ntfs         boot
 3      52.9GB  100GB   47.1GB            Free Space
 Type "p" and then Enter to print out the partition table.                                                               

In this example, my NTFS partition, which is homed on a SATA drive, is enumerated as partition 2 (sda2 in Linux device parlance, or hda2 if it was an IDE disk) is 52.9 GB, residing on a 100 GB drive; the rest of my system is allocated as free space. On your system, youÕll have different results, depending on your drive size and the size of your partition.

If your machine is a Windows-only box, and the whole drive is allocated for NTFS, you’ll likely have a single sda1 partition taking up the entire disk, which looks something like this:

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB 100GB    100GB  primary     ntfs         boot

Take note of this information, and then type q and Enter to exit parted.

Next, determine how much free space is left on that NTFS partition. Issue the following command from the SysRescCD prompt:

root@sysresccd /root%  df -k /dev/sda2

Here, /dev/sda2 refers to the name of your NTFS partition Ñ it could just be /dev/sda1 or /dev/hda1 if your drive is all NTFS. On certain machines, such as Dell PCs and laptops, the first partition is used as a “utility” partition, in which case /dev/sda2 is the first operating system partition, as in the examples above. I’ve reclaimed my “utility” partition to minimize the number of primary partitions on the system, as you can only have four.)

You should get output similar to the following:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2             51608808  33021912  18586896  64% /media/sda2

In this example, my 53 GB disk is 64 percent utilized (33 GB in use) with 19 GB remaining.

To reclaim some of the unused space on NTFS as free space by re-sizing the partition, I would issue the following command:

root@sysresccd /root%  ntfsresize /dev/sda2 -s 40G

In this example, I’ve specified the size of the new partition to be 40 GB. You can see ntfsresize in action in Figure Two. Make sure you leave enough free space left on the NTFS partition for Windows program data and swap . (It’s advantageous to boot into Windows before executing this command to offload some of your near-term storage to long term storage, such as burning your photos and MP3′s and other multimedia to DVDs and cleaning them off the drive.)

FIGURE TWO: ntfsresize in action on the SystemRescueCD

After performing a resize on your NTFS drive (or skipping it entirely if you’ve got enough free space on a local drive to install Linux), launch parted again at the console prompt and issue the following commands:

(parted) unit s
(parted) print

You should get output similar to the following:

Disk /dev/sda: 195371567s
Sector size (logical/physical): 512B/512B
Partition Table: msdos 

Number  Start       End         Size        Type      File system  Flags
 2      64260s      103281884s  103217625s  primary   ntfs         boot
 1      103281885s  195366464s  92084580s   extended
 5      103281948s  107282069s  4000122s    logical   linux-swap
 6      107282133s  107539109s  256977s     logical   ext3
 7      107539173s  195366464s  87827292s   logical   ext3

Make a of the bolded value for total sectors on the disk. Write this number down, subtract 63, and write down the result. Next, issue the following two commands in parted:

(parted) unit cyl
(parted) print

You should get output similar to the following:

Disk /dev/sda: 12161cyl
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 12161,255,63.  Each cylinder is
Partition Table: msdos 

Number  Start    End       Size     Type      File system  Flags
 2      4cyl     6428cyl   6425cyl  primary   ntfs         boot
 1      6429cyl  12160cyl  5732cyl  extended
 5      6429cyl  6677cyl   248cyl   logical   linux-swap
 6      6678cyl  6693cyl   15cyl    logical   ext3
 7      6694cyl  12160cyl  5466cyl  logical   ext3

Make a note of the values for cylinder, head, and sector geometry, respectively. Type a q at the parted prompt to exit.

Once you’ve re-sized your NTFS drive, reclaimed some disk space, and recorded your drive geometry values, go ahead and install your favorite Linux distribution on the free space.

Create and Customize the Virtual Machine Files

After installing Linux on your system, open a browser and download the vmdk and vmx files to your home directory. You can also download the files from http://www.linux-mag.com/download/2007-07/desktop/windows.vmdk and http://www.linux-mag.com/download/2007-07/desktop/windows.vmx.

Next, read in your hard disk’s master boot record (MBR) and export it to a file in your home directory. Issue the following command from a terminal prompt:

root@ubuntu-laptop:~# dd if=/dev/sda \
  of=$HOME/windowsxp.mbr \
  bs=512 count=63

You should get output like the following, as well as a file named windowsxp.mbr.

63+0 records in
63+0 records out
32256 bytes (32 kB) copied, 0.000809041 seconds, 39.9 MB/s

Next, open windows.vmdk file with a text editor and find this part of the file:

# Extent description
RW 63 FLAT "windowsxp.mbr" 0
RW 195371504 FLAT "/dev/sda" 63 

# The Disk Data Base

ddb.toolsVersion = "6530"
ddb.adapterType = "ide"
ddb.virtualHWVersion = "4"
ddb.geometry.sectors = "63"
ddb.geometry.heads = "255"
ddb.geometry.cylinders = "12161"

Edit the second RW line and the lines with sectors, heads, and cylinders, replacing the values in the file with the values you determined from the gparted session earlier. Save the file and exit.

Now you’re ready to run the windows.vmx file in VMware Player, VMware Server, or VMware Workstation. Choose “Windows” from the GRUB prompt, and then choose “VMware” from the Windows hardware profile menu. Figure Three shows Windows XP running virtualized from an RDM.

You can open up windows.vmx and tweak it to your desired settings, such as memory and virtual CPUs with the following fields:

numvcpus = "1"
memsize = "1024"

VMware Player can only support one virtual CPU. If you need more, use VMware Server, which is also a free download.

FIGURE 3: Windows XP, running virtualized from a raw device mapping

More About VMware

VMware has been covered extensively in prior issues of Linux Magazine. To learn how to install it on your system, please refer to “VMware Player“, “More Fun With VMware“, and “A Trio of Linux Tricks.”

Comments on "Run Your Windows With VMware"

Th?s design is wicked! ?ou d?finitely ?now how tto ke?p a reader
amused. B?tween you? wit and ?ou? videos, I
?as ?lmost moved t? start my own bblog (?ell, a?m?st…HaHa!) Gre?t job.
I re?lly enjoyed what ?ou h?d to ?ay, and m?r? th?n t??t, how you ?resented ?t.
Too cool!

My site: augers for sale

Pretty! ?his ha? beewn an incredibly wondeeful article.

M?ny t?anks for providihg t?is informat??n.

Her? is my webpage … power augers

It’s ?ard to f?nd w?ll-informed people ?n th?s topic,
butt you sound lik ??u know what ?ou’?e talking about!

?top by my website: post hole shovel

??at’s upp to ev?ry , ?? I am in fact eagewr
oof reading t?is webpage’s post t? be updated regularly.
It carries pleasant material.

?lso visit my webskte – auger machine

W?? visitors stil? use to r?ad news papers ?hen in this technological w?rld ?ll iis existing ?n web?

Feel free t? visit my web ?age :: electric auger

When I originally commented I clicked t?e “Notify me when new comments are added”
checkbox and now ?ach tie ? ?omment ?s ?dded I ?et four
?-mails ?ith t?e same ?omment. Is theee any way yo? c?n remove people from t?at service?
Apprecite ?t!

Also visit my blog post ice auger carrier for polaris ranger

It’s ?n point ?f fact ? ?reat ?nd u?eful pierce of
information. ? am satisfied t?at ?o? shared this helpful
?nformation w?th ?s. Please k?ep ?s up to date like this.
Thank you f?r sharing.

my web site – power ice auger

Hey! I simply wish to give a huge thumbs up for the great info you’ve got right here on this post. I shall be coming back to your blog for extra soon.

Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there’s even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That’s right AUTOMATICALLY, just watch this 4minute video for more information at. Seo Plugin

I truly appreciate this post. I¦ve been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thanks again

Glad to be one of the visitors on this awing web site : D.

Hello there. I found your website via Google whilst searching for a comparable subject, your web site came up. It seems good. I have bookmarked it in my google bookmarks to come back then.

What¦s Taking place i am new to this, I stumbled upon this I’ve discovered It positively helpful and it has helped me out loads. I hope to give a contribution & help different customers like its helped me. Great job.

Can I simply say what a reduction to seek out someone who truly is aware of what theyre talking about on the internet. You positively know tips on how to bring a difficulty to mild and make it important. More people need to learn this and understand this facet of the story. I cant imagine youre not more widespread since you undoubtedly have the gift.

Hello there. I found your website via Google whilst searching for a similar subject, your website came up. It seems to be great. I have bookmarked it in my google bookmarks to visit then.

Hello there, just became alert to your blog through Google, and found that it is really informative. I’m going to watch out for brussels. I will be grateful if you continue this in future. Numerous people will be benefited from your writing. Cheers!

I just want to tell you that I am just very new to blogging and absolutely enjoyed you’re page. Most likely I’m want to bookmark your website . You surely have terrific posts. With thanks for sharing with us your web page.

I want assembling useful information , this post has got me even more info! .

There is perceptibly a lot to realize about this. I assume you made various good points in features also.

An interesting discussion is worth comment. I think that you should write more on this topic, it might not be a taboo subject but generally people are not enough to speak on such topics. To the next. Cheers

Wonderful story, reckoned we could combine some unrelated data, nevertheless genuinely worth taking a look, whoa did one find out about Mid East has got additional problerms as well.

Sites of interest we have a link to.

Below you will obtain the link to some internet sites that we assume you’ll want to visit.

Always a huge fan of linking to bloggers that I adore but really don’t get a lot of link like from.

Thanks for another informative site. Where else may I am getting that type of info written in such an ideal manner? I have a project that I’m just now running on, and I’ve been on the look out for such information.

One of our visitors recently encouraged the following website.

That would be the finish of this article. Right here you will find some web pages that we feel you?ll value, just click the hyperlinks.

We came across a cool internet site that you might enjoy. Take a appear if you want.

wow, awesome post.Thanks Again. Awesome.

I truly enjoy reading through on this internet site, it has got wonderful articles.

One of our guests not long ago recommended the following website.

Here are some hyperlinks to websites that we link to for the reason that we feel they may be really worth visiting.

z3MDDA vxqyyudvrvhs, [url=http://cjmgiskzrivi.com/]cjmgiskzrivi[/url], [link=http://yqohgequygwd.com/]yqohgequygwd[/link], http://znljassprfcm.com/

Usually posts some really exciting stuff like this. If you?re new to this site.

The data mentioned inside the post are some of the top obtainable.

Here are a few of the web sites we recommend for our visitors.

Here is a superb Weblog You might Obtain Fascinating that we encourage you to visit.

That will be the end of this report. Right here you?ll come across some web pages that we consider you?ll appreciate, just click the hyperlinks.

The info talked about inside the report are a few of the ideal out there.

Wow, didn’t care about that aspect of computers.

The time to read or check out the subject material or sites we have linked to below.

Good info. Lucky me I reach on your website by accident, I bookmarked it.

One of our guests a short while ago proposed the following website.

Usually posts some quite intriguing stuff like this. If you are new to this site.

Hello, I think your site might be having browser
compatibility issues. When I look at your website in Opera, it looks fine but when opening
in Internet Explorer, it has some overlapping. I just wanted
to give you a quick heads up! Other then that, very good blog!

Here is my web page; EfrenEAmeigh

Below you will find the link to some web sites that we think it is best to visit.

Here is an excellent Weblog You may Come across Fascinating that we encourage you to visit.

We came across a cool web-site which you may appreciate. Take a search in the event you want.

We came across a cool web site that you may possibly enjoy. Take a search for those who want.

That may be the end of this post. Here you will locate some web-sites that we think you will value, just click the hyperlinks.

Leave a Reply