It is not very common to use an existing windows installation as a guest system for vmware. Yet it is very use uf you want to use windows from time to time directly, i.e. if you have a dual boot installation. It does not make much sense to use different windows installations.
Let’s assume there is an existing dual-boot installation! There are already a lot of descriptions available.
- Preparation of Windows XP
- Boot your Windows
- Set up an new Hardwareprofile e.g. ProfilVM: goto SYSTEM / HARDWARE / Hardware Profiles This is necessary since XP will run on a completely different hardware inside the virtual machine, i.e. to windows it looks like running on a different machine.
- Install the VMWare SCSI-Driver
- Download the Driver from the vmware site. Select the latest driver.
- Install the driver: this is a bit tricky since the hardware does not yet exist. First you need to tell windows that the hardware is already connected. Then you have to add the hardware manually and select SCSI-Drivers as hardware type. Finally select the downloaded driver.
- Deactivate WGA
- This can be done manually or use RemoveWGA: can be downloaded e.g. here
- Install VMWare Workstation
- Before starting you have to find out which device is your hard harddrive (e.g. mine is /dev/sda)
- make sure the device is writeable for the user who starts vmware
- Download the latest version : vmware workstation
- Create New Virtual Machine
- Start the wizard by click on “New Virtual Machine”
- Select Custom Installation
- Select New Workstation 5
- Select your OS
- Name it
- No. of processors, my suggestion “one”
- Memory: the more the better runs the guest but of course the host gets less
- network: depends on your situation, in general bridging or nat
- SCSI-Adapter: BusLogic (that’s the the driver for you installed before)
- Disk: Select physical disk
- Select “Entire Disk”, this way the normal boot loader is activated at boot time
- Now try to start your Virtual Machine: Select Windwos in the bootloader an select your new Hardwareprofile
- At the beginning your mouse will be captured by the vm, you can free it by using Ctrl-Alt
- If it runs: install VMWare Tools : vmware / VM / Install VMWare Tools
- Improve Installation by Booting from a Boot Disk
After destroying my bootloader setup I found a very cute way to boot from a boot disk: HOWTO setup the Boot Disk
update: since the links does not exist anymore: here is the original posting by Scott Bronson:
Running VMWare on a Physical Partition 66
Posted by Scott Bronson on 07/18/2006
This article describes how to set up VMWare on a pre-existing Windows partition.
VMWare is an incredibly useful piece of software. Problem is, it feels like it’s perched on the tip of an eggshell. Any change to its environment tends to cause it to fall over, isolating all your data in the VM until you can find the time to get it working again. It’s not fun to trust important data to such a brittle environment.
This article describes how to solve this by running VMWare on a physical disk partition. That way, when VMWare dies, you just boot into your Windows partition and continue working as usual. The convenience of VMWare, the reliability of dual-boot, what’s not to like?
* Your data is still safe even if VMWare never works again.
* You can use a pre-existing Windows partition under VMWare.
* You can’t suspend or snapshot the virtual machine.
Update 3 Aug: This article originally claimed that VMWare Server didn’t support sound. As Gunnar Johansson says below, it actually does. Go to Virtual Machine Settings, click Add, and add a Sound Device. Easy!
Prepare the Disk
I’m running Ubuntu Dapper on an IBM ThinkPad T-42p. The Linux partition is on /dev/hda1 and the XP partition is on /dev/hda3 (it’s actually better to put Windows on hda1 so you can have a C: disk; see Notes below).
1. Set up a dual-boot partition. I find it’s easiest to first partition the disk, then install Windows, then install Linux. Use the Grub boot loader. Make sure everything works 100%.
2. Make sure the hostnames for your Windows and Linux partitons are different! In a dual-boot environment, it’s very common to give each partition the same name. Of course, this is bad when both partitions are running simultaneously!
3. Turn off the Grub timeout. In /boot/grub/menu.lst, comment out the timeout line:
Normally Grub waits for a few seconds and then boots into a particular partition. While setting up the virtual machine, booting into the wrong partition could irrevocably destroy your Unix partition! So, for now, we need to ensure that Grub won’t do anything automatically. You can re-enable the timeout after setting up the boot disk below.
4. If you’re going to run VMWare as a regular user, you need to ensure the user has permission to access the physical partition. On Ubuntu/Debian, this should work:
adduser bronson disk
Beta versions of VMWare Server had a bug where the GUI would hang unless you ran it as root. Version 1.0 appears to have fixed this bug.
5. Install VMWare Server.
1. Boot into the Windows.
2. Create a separate hardware profile and install the drivers.
Control Panel -> System -> Hardware -> Hardware Profiles.
Click Copy, then name the copy you just created VMWare.
You should now have two hardware profiles, Physical and VMWare.
3. Booting into the wrong hardware profile can be disastrous. Ensure that “Wait until I select a hardare profile” is selected.
4. Remove anything that could cause trouble. For instance, even if disabled in the VMWare profile, Lenovo’s pre-installed ThinkPad software crashes under VMWare. Remove it — you won’t miss it. Try to make your system as close to bare vanilla Windows as you can.
5. Reboot into the Linux.
Create the Virtual Machine
Launch VMWare and connect to Local Host.
1. File -> New -> New Virtual Machine.
2. Select “Custom”, Next
3. Select your operating system (mine is WinXP Pro), Next
4. Give it a name like “WinXP”, Next
5. Specify One processor, Next
6. Choose public or private (on a single-user machine this doesn’t matter), Next
7. Select the memory to devote to the virtual machine. The more memory you devote, the better the guest OS runs (unless you exhaust your physical machine’s memory) but the longer it takes to suspend and resume. 512 MB is a pretty useful number.
8. Select your network connection, Next. If you want the virtual machine to be able to connect to the Internet, you will need to select either bridging or NATing. Since my laptop spends a lot of time roaming among wifi access points, I choose NATing. That way, once the Unix network connection is configured, the windows connection happily piggybacks on top of it. Also, the Windows operating system is hidden behind a NAT which should be a lot safer. Of course, this means that Windows can only open outgoing connections, not incoming. If you’re setting this up in a server environment where the network is fairly static, bridging is probably the better choice.
9. Leave SCSI set to BusLogic, Next
10. Use Physical Disk, Next
11. Use individual partitions, Next
12. Select 2 partitions: the Windows partition (of course), and your regular boot partition so that VMWare can access your bootloader’s second and third stages. If you don’t select your boot partition as well as the Windows partition, LILO and Grub probably won’t work.
13. Specify the place to save the VM
On your new Virtual Machine:
1. Click on Settings -> Hardware -> Floppy and turn off “Connect at power on”. We’ll fix this later in “Setting up the boot disk.”
Fire Up the Virtual Machine
1. Turn on the virtual machine. Remain sharp because the next step is important.
2. At the lilo prompt, make sure you boot windows! There’s no way for the computer to tell if a partition is currently in use so, if the VM starts booting your currently-mounted Unix partition, shut it down ASAP! I can’t stress this enough: if you run two OSes from the same partiton, you will almost certainly corrupt the partition. Make sure you boot Windows.
3. At the Physical/VMWare prompt, choose VMWare. This is also important — if you accidentally use the wrong harware profile, it can take days to undo the damage.
4. Log in normally. You will be assaulted by all kinds of “Found New Hardware” dialogs. Click cancel! Try to change things as little as possible.
5. Install VMWare Tools.
From VMWare menus: VM -> Install VMWare Tools
Click OK, then you should see an InstallShield installer launch in the virtual machine. Use InstallShield to ensure the tools are successfully installed.
6. Reboot the virtual machine (click Yes to the InstallShield prompt).
7. Set up all the hardware devices. Choose your screen resolution, ensure networking works, etc. At this point, the virtual machine should work great. You also might want to:
* Turn off the Windows screen saver:
Control Panels -> Display Properties -> Screen Saver
* Turn off all power saving settings:
Power -> Turn off monitor: never, Turn off hard disks: never, etc.
8. Shut down the virtual machine, quit VMWare, then shut down Unix.
9. Boot into the physical Windows partition. Make sure to select the Physical hardware profile.
10. Ensure that the physical machine still works 100% correctly. You should see a number of new devices installed for the VMWare profile, but they should not cause trouble as they will all be disabled in the physical profile.
You should now have two happily co-existing operating systems. Windows should behave the same whether you booted into the physical machine or the virtual one.
If this section is confusing, you might find some help here.
Set up the Boot Disk
It’s a pain to tell Grub which partiton to boot each time you fire up your virtual machine. And, if you make a mistake, horrible disk corruption will surely follow. So let’s get rid of that prompt so the virtual machine goes straight into Windows each time. We will create a boot floppy image and tell VMWare to always boot from that. It’s the same concept as using a Linux rescue disk.
1. Ensure you’re booted into Linux and the VM is powered off.
2. Open the VM Settings window, click on Hardware -> Floppy
* Select “Use a floppy image”
* Click “Create” and create a new image. Call it bootdisk.img
* Click “Connect at Power On”
3. Now add grub to the disk image file:
$ dd if=/lib/grub/i386-pc/stage1 of=bootdisk.img count=1
$ dd if=/lib/grub/i386-pc/stage2 of=bootdisk.img seek=1
This is for Debian/Ubuntu. On Gentoo, the Grub files are found in /usr/lib. You can try running “locate stage1″ if you can’t find the stage1 and stage2 files.
4. We’ll need the non-filesystem grub disk for later so back it up.
$ cp bootdisk.img grubdisk.img
5. Now start up the VM. You should be dropped straight into Grub.
6. Try booting Windows using:
grub> root (hd0,2)
grub> chainloader +1
Of course, you need replace (hd0,2) with the location of your own windows partition. You can find the exact commands to use in /boot/grub/menu.lst.
7. You should now be booted into your Windows virtual machine. If not, you need to figure out what went wrong before proceeding.
We will now modify the boot disk to run those commands automatically whenever the VM is powered on.
1. You should still be running the Windows virtual machine.
2. Format the boot floppy.
1. Desktop -> My Computer
2. Right click the “A:” icon and choose “Format…”
3. Click start. The defaults are fine.
3. Shut down the VM
4. Mount the image under Linux and copy in the Grub files. You may need to be root to do some of these operations.
$ mount bootdisk.img /mnt -o loop
$ mkdir -p /mnt/boot/grub
$ cp /boot/grub/stage /boot/grub/fat_stage1_5 /boot/grub/menu.lst /mnt/boot/grub
$ vi /mnt/boot/grub/menu.lst # remove the cruft; see next step
$ chmod -R a-w /mnt/boot
$ umount /mnt
5. This is what my bootdisk’s menu.lst file looks like:
title Windows XP
6. Click “Edit Virtual Machine Settings” -> Hardware -> Floppy 1 and tell VMWare to boot using grubdisk.img (the copy we made earlier). Click OK.
7. Turn on the virtual machine. You will be dropped into the Grub prompt. Don’t type anything.
8. Switch the floppy in the virtual floppy drive to bootdisk.img. VM menu -> Settings -> Hardware -> Floppy 1 and type the name into the textbox. The disk is switched when you hit OK.
9. Type the setup command:
grub> setup (fd0)
10. Reset the virtual machine. VMWare will now try to boot from bootdisk.img instead of hda’s master boot block, and bootdisk.img should send you straight into Windows.
11. Now that VMWare isn’t using your master Grub configuration, and there’s no danger of VMWare booting into the Unix partition, you can re-enable the timeout in /boot/grub/menu.lst.
Unfortunately, you still need to deal with the Physical/VMWare hardware profile selector. I haven’t figured out any good way of getting VMWare to automatically select the VMWare profile.
See http://www.openbg.net/sto/os/xml/grub.html if any part of setting up the boot disk is confusing. It offers a more generic version of these instructions.
You should now have a VMWare machine running on a physical partition. If VMWare ever dies, you can just dual boot into your Windows partition and continue working.
As far as I can tell, because we’re using a physical partition, we don’t have any control over drive letters. If you install windows onto /dev/hda3, your main disk will be F: not C:. Generally this is only a problem for stupid Install Shield installers that try to install onto the nonexistant C: drive. Just remember to change the destination directory when installing. This isn’t a problem caused running under the virtual machine, it’s because you’re running Windows on a partition other than the first one. You’d see it when running dual-booted as well.
Notes / TODOs
* It’s really useful to share your Linux home directory using Samba and mount it on the windows partition. This howto is already long enough; I might tell how to do this in a different blog entry.
* It would be nice to have VMWare automatically select the VMWare hardware profile in the profile selector.
* A friend tried to get VMWare running on his ThinkPad T-43 but ran into problems with the SATA hard disk.
* Tags vmware, windows
* Meta 66 comments, permalink, rss, atom