By Dmitri Popov
Theoretically, a bootable USB stick with a Linux distribution lets you carry your Linux desktop with you without installing any software on the host machine. In practice, however, your Linux-on-a-stick might not be as universal as advertised. Sometimes you must ask the permission of the owner of the computer you are using, and many PC owners are reluctant to let their friends boot to a totally different operating system. In some cases, you might need to manually reconfigure the BIOS to support a USB boot. Many Internet cafes do not even let you reboot the system, so booting into Linux simply isn't an option.
An easy solution to this problem is a virtual machine based on the popular QEMU emulator [1]. With QEMU, you can install a Windows version of QEMU on a USB stick, create a Linux-based virtual machine, and run Linux as a virtual system inside Windows.
The excellent Qemu Manager [2] tool lets you turn your USB stick into a portable computing environment (Figure 1). Qemu Manager wraps the QEMU functionality into a sleek and user-friendly graphical interface that lets you create, manage, and run virtual machines with consummate ease. Installing Qemu Manager is as simple as downloading the zipped version of the tool, unpacking it in a folder on the USB stick, and double-clicking on the QemuManager.exe executable to launch Qemu Manager.
Qemu Manager boasts an easy-to-use interface that provides access to almost all of QEMU's features (Figure 2). If you've ever tried to work with virtual machines in any other virtualization software like VirtualBox or VMware Player, you'll feel at home with Qemu Manager. The main toolbar at the top of Qemu Manager's window contains buttons that allow you to create, delete, and launch virtual machines. In addition, the Create Disk Image button lets you create an image from a CD or DVD. This feature can come in handy if you have to generate an ISO image to use with a virtual machine from a system CD or DVD. To create and manage so-called VM stores or virtual machine repositories containing configuration files and disk images, use the Manage VM Stores button. Finally, the Add/Remove Hardware button allows you to add and remove hardware components in a virtual machine. The right pane of the main Qemu Manager window contains three sections: Hardware, where you manage and configure the virtual machine's hardware modules; Drives, for managing the virtual machine's hard disks, optical drives, and snapshots; and Advanced, where you can tweak QEMU's advanced settings. The left pane lists the current virtual machines.
Creating a new virtual machine in Qemu Manager is very easy. Before you press the Create new VM button, though, you need to download an ISO image of the Linux distribution you want to use with Qemu Manager. Alternatively, you can use the Create Disk Image button to convert the inserted CD or DVD into an ISO image. Place the downloaded or generated ISO image into the Media folder inside your Qemu Manager folder on your USB stick. It is important that you keep all .iso images in this folder so your virtual machine can find them no matter which letter Windows assigns to the USB stick. Now you can press the Create new VM button, which starts a wizard that guides you through the process of creating a virtual machine (Figure 3). Setting up a new virtual machine only requires you to specify a few basic settings, such as guest operating system (Linux Distribution), a platform for the virtual machine (choose Standard x86/x64 PC if you plan to use the virtual machine on Intel or AMD-based machines), memory size, and a virtual disk image. The last two settings depend on the Linux distribution you want to use with the virtual machine; for example, running lightweight distros like Puppy Linux or SliTaz will require about 128MB RAM and a relatively small hard disk. When setting up a virtual disk image, you have the option of encrypting it, which provides an additional level of security.
If you need to, you can always modify the virtual machine's settings specified in the wizard in the Hardware section. Editing the settings can be useful when you need to tweak the virtual machine to run optimally on the computer at your disposal. For example, if you run the virtual machine on a computer with a dual-core processor, you can adjust the No of CPUs setting accordingly. Does the host machine use a 64-bit processor? Then set the CPU Type option to 64-bit. When creating a virtual machine, you might also want to enable the Qemu Manager QEMU Client, which adds a few useful features like the ability to manage physical and virtual drives, send the Ctrl+Alt+Del command to the guest system, pause and resume the virtual machine, and manage snapshots.
Before you launch the created virtual machine, you have to specify the .iso image as the boot device. In the main Qemu Manager window, switch to the Drives section, double-click on the CD-ROM item, select the .iso image, and press OK. Now double-click on the Boot Drive item and select CD-ROM from the Boot From drop-down list. Later, if you decide to install the Linux system on the virtual hard drive, you can remove the .iso image and set the Boot Drive to Hard Disk.While you are at it, you can tweak other settings, too. For example, if you want to exchange files between the guest and host systems, you can enable the file transfer feature. File transfer occurs through a local FTP server that the guest system then accesses with the use of an FTP client. To enable the file transfer feature, choose File Transfer | Configure File Transfer Server in the main menu (Figure 4). If you want to share a specific folder, tick the Share The Following Folder Only checkbox and select the desired folder. Once you've configured and saved the server, choose File Transfer | Start File Transfer Server in the main menu to start the server. Then you can access the FTP server from your Linux system running in QEMU with the 10.0.2.2 address and QEMU as both username and password.
Once the virtual machine is configured, fire it up with the Launch Selected VM button on the main toolbar. If you enabled the Qemu Manager QEMU Client, you can control the virtual machine session with the buttons on the top toolbar. Most of these buttons are self-explanatory except, perhaps, VM Snapshot Management.
Like other virtualization systems, QEMU allows you to take a snapshot of the virtual machine's current state. Then you can use the snapshot to launch the virtual machine in exactly the same state you left it. The VM Snapshot Management button provides access to commands that let you take a snapshot of the virtual machine, as well as load and delete existing snapshots.
Emulate or Virtualize |
Before you create and run a virtual machine, keep in mind that QEMU can act as either an emulator or a virtualizer. When used as an emulator, QEMU "mimics" the Pentium II processor, dynamically translating the guest application's calls into native instructions. Although QEMU offers decent performance by emulator standards, it is still too slow to be genuinely useful. When used as a virtualizer, QEMU achieves near native performance by executing the guest code directly on the host processor. The virtualizer mode is by far the best way to use QEMU, but it requires the KQEMU accelerator software on the host machine. Fortunately, Qemu Manager makes it extremely easy to install the KQEMU component. Simply choose the Options | Install KQEMU Accelerator command from the main menu to turn QEMU into a virtualizer. Once you're finished using your virtual machine, choose the Uninstall KQEMU Accelerator command. |
The QEMU/Qemu Manager combo makes a perfect solution for running a Linux environment inside Windows. Using Qemu Manager, you can easily create and manage virtual machines and stay productive, even when you only have access to a Windows machine. Even if you carry your notebook or netbook with you, having a ready-to-use virtual machine on a USB stick provides an excellent backup option.
INFO |
[1] QEMU: http://www.nongnu.org/qemu/
[2] Qemu Manager: http://www.davereyn.co.uk/ |
THE AUTHOR |
Dmitri Popov holds a degree in Russian language and computer linguistics. He has been writing exclusively about Linux and open source software for several years, and his articles have appeared in Danish, British, North American, German, and Russian magazines and websites. |