Da die Anleitung komischerweise nicht mehr erreichbar ist, ich sie aber noch auf meinem Rechner im Müll gefunden habe, poste ich sie hier einfach mal....
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?
Benefits:
- Your data is still safe even if VMWare never works again.
- You can use a pre-existing Windows partition under VMWare.
Drawbacks:
- 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).
- 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%.
- 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!
- Turn off the Grub timeout. In /boot/grub/menu.lst, comment out the timeout line:
# timeout=30
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. - 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. - Install VMWare Server.
Prepare Windows
- Boot into the Windows.
- 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. - Booting into the wrong hardware profile can be disastrous. Ensure that "Wait until I select a hardare profile" is selected.
- 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.
- Reboot into the Linux.
Create the Virtual Machine
Launch VMWare and connect to Local Host.
- File -> New -> New Virtual Machine.
- Select "Custom", Next
- Select your operating system (mine is WinXP Pro), Next
- Give it a name like "WinXP", Next
- Specify One processor, Next
- Choose public or private (on a single-user machine this doesn't matter), Next
- 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.
- 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.
- Leave SCSI set to BusLogic, Next
- Use Physical Disk, Next
- Use individual partitions, Next
- 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.
- Specify the place to save the VM
- Finish!
On your new Virtual Machine:
- 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
- Turn on the virtual machine. Remain sharp because the next step is important.
- 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.
- 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.
- 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.
- 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. - Reboot the virtual machine (click Yes to the InstallShield prompt).
- 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.
[*]Shut down the virtual machine, quit VMWare, then shut down Unix.[*]Boot into the physical Windows partition. Make sure to select the Physical hardware profile.[*]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.
- Ensure you're booted into Linux and the VM is powered off.
- 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"
[*]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.
[*]We'll need the non-filesystem grub disk for later so back it up.
$ cp bootdisk.img grubdisk.img
[*]Now start up the VM. You should be dropped straight into Grub.[*]Try booting Windows using:
grub> root (hd0,2)
grub> chainloader +1
grub> boot
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.
[*]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.
- You should still be running the Windows virtual machine.
- Format the boot floppy.
- Desktop -> My Computer
- Right click the "A:" icon and choose "Format..."
- Click start. The defaults are fine.
- Shut down the VM
- 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[12] /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
- This is what my bootdisk's menu.lst file looks like:
default 0
timeout 0
hiddenmenu
title Windows XP
root (hd0,2)
makeactive
chainloader +1
- Click "Edit Virtual Machine Settings" -> Hardware -> Floppy 1 and tell VMWare to boot using grubdisk.img (the copy we made earlier). Click OK.
- Turn on the virtual machine. You will be dropped into the Grub prompt. Don't type anything.
- 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.
- Type the setup command:
grub> setup (fd0)
- 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.
- 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. The End!
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.