The Best of Both Worlds
I recently bought an IBM ThinkPad laptop with 1GB of RAM and Windows XP preinstalled. Because I have been using only Linux for many years, I immediately thought about making it a dual-boot system (actually a multiboot system, because I usually install several copies of Linux on my computer).
As I said, I mainly use only Linux, but I also keep a copy of Windows around, because other people may need to use my computer who are not able to use Linux. Also, being a computer specialist, I like knowing all the ways of using a computer, not only the best one, and as many people still use Windows, I want to understand their points of view.
So, I now can reboot and switch from Linux to Windows and from Windows to Linux. However, I thought it would be useful to run both systems in parallel, instead of switching from one to the other. One of the reasons for this is the Windows XP Home Edition that was installed on my laptop is customized by IBM specifically for this laptop, and there are some tools developed by IBM that make things more convenient. Another reason is that I wanted to test a client-server network with Windows as the client and Linux as the server. I'm sure you can think of other reasons for doing this as well.
After some research and testing, I decided to use QEMU. Now I can run any of the Linux distributions that are installed on the other partitions on Windows. I also can access Windows from the Linux system. I can access the Internet from the Linux system, and I can access any of the Linux services from Windows. Additionally, I can access certain Linux services from the network. It's like having two systems running on the same machine at the same time.
Running Linux inside Windows using QEMU is not difficult; however, doing it well requires some tricks that I didn't discover immediately.
Installing QEMU in Windows is easy. I downloaded qemu-0.9.0-windows.zip and extracted it in D:\QEMU. I didn't forget to read README-en.txt (always read READMEs). Then, I made a copy of the batch file (script) qemu-win.bat and renamed it start-linux.bat. To access it more easily, I created a shortcut (link) for it on the desktop by doing a right-click and selecting Send to→Desktop. Then, I modified the last line of start-linux.bat to look like this:
qemu.exe -L . -m 128 -hda \\.\PhysicalDrive0 -soundhw all -localtime
The modification consists of replacing the parameter -hda linux.img with the parameter -hda \\.\PhysicalDrive0. Now, when I start QEMU by running this script, instead of using the file linux.img as a virtual hard disk, it uses my real hard disk and boots from it. Then, I see the beautiful GRUB menu that is installed in the MBR of my hard disk, and I select and boot one of my Linux systems. Isn't it great?
Be careful not to boot Windows again inside Windows. According to the documentation, using the same disk image in more than one machine can corrupt it.
The system that I usually boot inside Windows is Fedora Core 6. The parameter -m 128 tells QEMU to use up to 128MB of RAM for the emulated system. With 128MB of RAM, Fedora isn't able to run in graphic mode and falls back to text mode. However, with 256MB of RAM, it works. If you have 1GB of RAM in your machine, like me, you could be generous and give 512MB to Linux.
The graphical interface is important to me, but I am quite happy with command-line Linux. In order to run Fedora in text mode, even though it has 256MB of RAM, I pass the 3 parameter to the kernel, which tells it to boot in run-level 3. Initially, I did this manually, with these steps:
Select Fedora in the GRUB menu.
Press E to edit it.
Select the kernel line.
Press E to edit it.
Append 3 at the end of the kernel line, and press Enter to return.
Press B to boot the modified Fedora entry.
Later, I added another entry to the menu, with the 3 parameter appended to the kernel line in order to boot it more quickly, which looks like this:
title Fedora Core TextMode (2.6.18-1.2798.fc6) root (hd0,7) kernel /boot/vmlinuz-2.6.18-1.2798.fc6 ro root=/dev/hda8 rhgb quiet 3 initrd /boot/initrd-2.6.18-1.2798.fc6.img
Sometimes I see several error messages and failures while Linux is booting (for example, when I tried Scientific Linux), but I ignore them. The reason for this is the hardware of the emulated machine (which is being emulated by QEMU) is somewhat different from the hardware of the real machine. The same thing happens when the hard disk is taken from one machine and placed in another. Linux autodetects the machine's devices and reports that some devices are missing and new devices are added (for example, network cards). I simply keep the configurations of the “removed” devices and let Linux autoconfigure the new devices it finds.
- VMware's Clarity Design System
- Let's Go to Mars with Martian Lander
- Applied Expert Systems, Inc.'s CleverView for TCP/IP on Linux
- Papa's Got a Brand New NAS
- My Childhood in a Cigar Box
- Rogue Wave Software's TotalView for HPC and CodeDynamics
- Jetico's BestCrypt Container Encryption for Linux
- Panther MPC, Inc.'s Panther Alpha
- Linux Journal January 2017
- Debugging Democracy