Using qemu on Windows (Basics)

Have you ever felt an urge to use Linux in your office but you are not allowed to install it without permission. Additionally you are not allowed the partition the Hard Disk. What could be a solution? Very simple, get a Virtual Machine. Now again a new problem comes up- Virtualizing softwares are quite big and take for example VMWare are too big itself to be handled and cant be kept hidden on your computer.

This is my experience what I did when faced these problems. I downloaded qemu for Windows and also the ISO of the Linux I wanted to use. In my case it was Xubuntu as I wanted a lightweight distro. First of all you dont need to install qemu at all, just unzip it and keep it in any folder of you choice. Neither do you have to add any Product key or anythin of the sort. Here it the step by step proceedure what needs to be done to make a Virtual copy of Linux running on yor system.

1. Get a copy of the ISO of your Operating System

I wanted to install Linux – Xubuntu and download a copy of it from the main website. You can get any OS, doesnt need to be Xubuntu. It can be OpenSolaris, OpenBSD, FreeBSD or Windows itself

2. Create a virtual Hard Disk

This step is useful only if you want to install the OS, if you intend just to run LIVE without installing, you can skip this stage.

qemu-img.exe create filename 4000M

Where filename is the name of the file you are intending to use as a Hard Disk and 4000M means the size of the file is 4000MB. To create files of size more than 4GB you need to be on NTFS Filesystem as older ones cant handle such large files.

3. Start the OS in Live Mode

In this case you dont need to have a Hard Disk, just an ISO required. Boot from it using the command

qemu.exe -cdrom isoimage.iso -boot d

In this case isoimage.iso is the file which contains the ISO and is to tell that you want to boot from CD. In this case you have chosen to make CDROM as an ISO.

4. Install the OS on the Disk you created

In this you need to have the Disc created along with the ISO, use this command

qemu.exe -cdrom isoimage.iso -hda filename -boot d

The above command means that you chosen ISO as the CDROM, filename as First Hard Disk (hda) and you wanted to boot from CDROM ( -boot d )

Install from the ISO, when it is complete, just exit from qemu.

5. Starting an installed OS

This case is when you have installed from the ISO and want to use it regularly. In this case just issue the command

qemu.exe -hda filename -boot c

Here -boot c tells to boot from the first Hard Disk, you dont need -cdrom option as you have already installed the OS. You can have more than one hard disk, by specifying the -hdb ,-hdc and -hdd option, but you can only boot from -hda.


  • I was not able to connect to network even after specifying a lots of options. If your network doesn’t work and you want to  have some files on the guest OS, then download it on host OS, make an ISO from all those files using some tool like MagicISO. Then before starting the Virtual Machine, specify this ISO in the -cdrom options but use -boot c option itself to boot from the hard disk. Now when you are inside the OS, just mount the ISO using the command

mount /dev/scd0 /media/cdrom

  • Dont ever close the running Host OS using the close button of available in windows. Maybe you might not understand why at the first glance, but you can corrupt your data or installation. Dont even try to open two instances of the Guest OS using the command two times using the same Hard Disk file. You can badly screw up your installation.
  • -boot option can be used to control the boot priority as you did in BIOS settings. ‘a’ means floppy drive, ‘c’ means Hard Disk and ‘d’ means CD Drive.
  • Since you can have more than one Hard Disk you may be tempted to use the Hard Disk images in any order you want. This is highly unrecommended because MBR is only on the first Hard Disk. If you have Second Hard Disk on hdb when installing, swapping them too may lead to unbootable state as the Second Hard Disk doesnt have a MBR.
  • You can even start the Guest OS in full screen mode using the -full-screen option
  • Lastly, qemu can even access your Host OS’s hardware itself. You can install Linux/OpenSolaris etc on the physical partitons itself. You can directly access the physical CD Drive inside the Guest OS. All these would be covered in the next Tutorial.

What is GRUB or a bootloader?

GRUB is an abbreviation for GRand Unified Bootloader, its actually a product of the GNU project aimed at creating a bootloader which can boot nearly all operating systems. So now what is a bootloader? We shall now know this in nearly a layman’s approach.
When you switch on your computer, it fetches which operating system to boot from a special place on the hard disk called Master Boot Record(MBR). After that the required operating system is started. This does not need any complications if you have jus one operating system. Now if you have more than one operating system, the new circumstance are explained below.
Consider that there are two friends who got an internet connection and want to share it. What would they do? They will get a hub or a switch to split the line into two so that both of you can get a chance. In the same way consider a bootloader to be like a hub or a switch. It is placed in the MBR and gives you the option to boot any of the many OS which you might be having on your system. Now let u see how this happens.
Your computer is powered on. The contents of the MBR is checked for booting the OS. GRUB should be placed at the MBR so that it can be booted. Now you get a menu at the GRUB to boot your choice of OS. Just select the required and press Enter. That’s done.
Actually GRUB is not completely installed on the MBR. The size of MBR is very small- just 512 bytes. Actually on the MBR only a small portion of GRUB is placed whose function is the bring up the complete GRUB(bootloader). Thus we can say that MBR contains a pointer to the GRUB which is actually located on some other portion on the disk.

Troubles that can crop up:
If you have GRUB installed on some partition say on partition X and a pointer to this partition on MBR. Now if you by mistake delete that partition or format it, you  will lose you GRUB though a pointer may still be containing on the GRUB. So now even though GRUB is on your MBR, you still cant boot any of your OS and you would be greeted by some error message like GRUB error 15,GRUB error 17 or GRUB error 22 depending on the case.
If you have installed Windows after installing Windows you must have noticed that GRUB has vanished. Actually it does not vanish, what happens that Windows replaces itself to the GRUB unhooking GRUB from it. Now GRUB is installed on your computer but still its does not have pointer from the GRUB, its useless now. You need to put GRUB back to the MBR for restoring the original conditions.