How to dual-boot Ubuntu 12.04 and Windows 7

One tool that has seen very little or no change over the past several releases in Ubuntu Desktop is the installation program. So it is somewhat surprising that some users are having a hard time dual-booting Windows 7 and Ubuntu 12.04 using a tutorial written for Ubuntu 11.04.

Stemming from comments in that article, and email from readers, I decided to revisit that tutorial using Ubuntu 12.04. So the purpose of this article is to show how to dual-boot Windows 7 and Ubuntu 12.04 on a computer with one hard drive. And it will be on a computer with an existing installation of Windows 7. If there is a need to, you may reinstall your copy of Windows 7.

If you want to attempt this on a computer with two hard drives, see how to Dual-boot Ubuntu 12.04 and Windows 7 on a computer with 2 hard drives.

To get started, download an installation image of Ubuntu 12.04 from here. Depending on your platform, you may download the 32- or 64-bit image. Screenshosts used in this tutorial were taken from test installations using a 32-bit installation image in both a virtual environment using VirtualBox, and on real hardware. In either case, I did not encounter any errors that others have reported, so I am certain that if you follow this guide, you should have a computer with both Windows 7 and Ubuntu 12.04 installed in a dual-boot configuration.

So that anytime you reboot the computer, you should see Windows 7’s boot menu with two entries listed – Windows 7 and Ubuntu 12.04 (LTS). Then you may choose to boot into Windows 7 or Ubuntu 12.04.
Windows 7 Dual-Boot Boot Menu

Now that you know what the overall goal is, how do you get from here to there? First, understand that if you have a computer running Windows 7, that Windows 7’s boot manager is responsible for making sure that the system boots. Installing Ubuntu on the same hard drive throws another boot manager into the mix. So the most important decision you are going to make about this, is which boot manager (Windows 7’s boot manager or Ubuntu’s) do you want to be responsible for primary boot operations?

When dual-booting Windows 7 and a Linux distribution on a computer with one hard drive, the best option is to have Windows 7’s boot manager be the primary boot manager. Why? Because whenever you reinstall or update Windows 7, its installer will overwrite anything it finds in the portion of the hard drive where critical boot-related programs are installed. That portion of the hard drive is known as the Master Boot Record (MBR). Also, certain anti-virus programs have been known to mess with the contents of the MBR, so installing GRUB in another location will ease the maintenance headache associated with your system. This point determines where GRUB will be installed.

If you are not familiar with disk partitioning (in Linux) and dual-booting, it is highly recommended that you read guide to disks and disk partitions in Linux and tips for dual-booting Windows and Linux.

By default, a new installation of Ubuntu 12.04 is installed on two partitions – a main partition, and Swap. The main partition is usually a primary partition and the Swap, a logical partition. And if Ubuntu is the only operating system on the hard drive, you will see both partitions labeled /dev/sda1 and /dev/sda5. Because you are going to install it on a computer with another operating system on it, the partitioning scheme will have to change.

The recommended partition scheme that will work better with the system you are about to install will have at least three partitions. They are the:

  • Boot partition – This is where GRUB will be installed, instead of in the MBR. Installing GRUB in the boot partition is where users have encountered errors, so pay particular attention to what you do with this partition
  • Root partition – This is where all the programs will be installed
  • Home partition – This is optional, but it helps to have your files and folders on a separate partition
  • Swap space

I think what you need to do should be pretty clear now. Time to begin the process! If you have not done so already, burn the installation image (of Ubuntu 12.04) you downloaded to a CD or transfer it to a USB stick, and boot the computer from it. When booted from the CD, you will be given the option to boot into a Live Desktop or start the installation without visiting the Live Desktop. It does not matter which option you choose, but booting into the Live Desktop and starting the installation from there seems to be a very good choice.
Ubuntu 12.04 Live Desktop or Installer

Whether the installation process is started from the Live Desktop or not, clicking through the installer gets you to the step shown in the image below. The most important information here is the minimum disk space (4.4 GB) recommended for a successful installation of Ubuntu 12.04. That piece of information will help you determine how much disk space to allocate to the root partition.
Ubuntu 12.04 Installation Requirements

Clicking Continue from the previous step will land you here. If, as in this example, you have Windows 7 installed on the target hard drive, you should see the same three options shown here. Because you will be creating partitions manually, the option you want to select is Something else.
Ubuntu 12.04 Partition Options

That should bring you to the Advanced disk partitioning tool. Again, if we are operating from the same point, that is, if you have a default installation of Windows 7 on the target hard drive, you should see two ntfs partitions (/dev/sda1 and /dev/sda2) listed. The main Windows 7 partitions, also popularly known as the C drive, is your sda2. To install Ubuntu, you will have to resize that partition. Note: If have free unallocated space on the hard drive, you do not have to go through this partition resizing process. To resize the partition, select it and click the Change button.
Ubuntu 12.04 Advanced Partition Tool

That should open this window. The only thing to do here is tell the installer how much disk space you want to keep for Windows 7. The rest will be used for Ubuntu. The system used for this tutorial has about 324 GB of disk space. I chose to keep 100 GB for Windows.
Ubuntu 12.04 Partition Resize

So the window now looks like this. Click OK.
Ubuntu 12.04 New Partition Size

After the partition has been resized successfully, you should see the freed space marked as free space. Select it and click Add to start creating partitions for Ubuntu 12.04.
Ubuntu 12.04 Unallocated Partition Space

We Recommend These Vendors

Launch an SSD VPS in Europe, USA, Asia & Australia on Vultr's KVM-based Cloud platform starting at $5:00/month (15 GB SSD, 768 MB of RAM).

Deploy an SSD Cloud server in 55 seconds on DigitalOcean. Built for developers and starting at $5:00/month (20 GB SSD, 512 MB of RAM).


  1. Thanks, but i have one problems, still.

    When i fallot your steps and reboot it takes me to grub bash’thingy and doesn’t boot up ubuntu.

    Any ideas what i have done wrong ?

  2. Worked like a charm. Life saver – Cheers mate,
    That is such a neat solution !

  3. Thanks a billion for the tutorial!

    It took me a while to get it right because my HP laptop is delivered with 4 partitions already on the drive.

    However, once I realized all I had to do was delete a partition- I chose the ‘HP Tools’ partition – it was smooth sailing through the tutorial…

  4. I haven’t tried this yet, but just for clarification, each of the partitions are logical, yes? In the pictures they are, but I just want to make sure.

  5. Sir,
    I had followed this tutorial to install Ubuntu 12.04 alongside Windows 7 and Windows 8, so I had a case of Triple boot.
    However, I don’t know how, Ubuntu was my primary boot manager and then Windows 8.
    But recently I deleted the Windows 8 and upgraded my Windows 7 to Windows 8. Now Windows 8 is my primary boot loader but I can’t access the Ubuntu OS nor can I access the Ubuntu drives since they are of ext 4 format.
    What should I do?

  6. Hello Sir …

    Sorry I posted my question before on your post

    Back then I didn’t knew that I have only one HDD…

    I am currently running windows 7 32 bit with 1 GB RAM & want UBUNTU 12.04 alongside it…

    So..what should be the size of the 4 partitions provided that I have 30 GB of UNALLOCATED SPACE…

    Can you tell me now which one would be best for me..

    32 bit or the 64 bit…??

  7. Thanks for the tutorial, but I have a quick (and hopefully not stupid) question: Can the two main partitions used for data storage (one for Windows and one for Ubuntu) be merged into one partition and shared among Windows OS and Ubuntu?

    • The answer is no, but you can create an ntfs partition from Windows that you can use to share data between both OSs. Note that you can also access files in the C drive from Ubuntu.

      You might want to read this and this.

  8. Thanks for the guide, But i got an issue here. After I choose to boot the ubuntu (I already followed through all from the guide) it didn’t take me to the Ubuntu. Instead, I got into somekind of command prompt.
    Can you help me?

    • Can you share some info about your hardware?

      What’s the size of the hard drive and how much of that is allocated to Windows?

      • I’m having this problem, using a 256gb SSD, ~220 to windows, the rest to Ubuntu.

        • Same problem here for me. Followed instructions exactly, except I skipped the /home partition, as I’m the only intended user of this installation. Started with 120GB SSD, setting aside 55 GB for Ubuntu (500MB boot / 50GB root / 4.4GB swap). After selecting Ubuntu at boot time, I get a GRUB2DOS screen, with a grub> prompt.

          • The issue is the same as I was having Google how to set “NOMODESET” in your setup then once you install you need to download the proper drivers for your video card. Not too tough of a fix however!

  9. I am attempting to do this tutorial, but I have a problem. Once I specify the partitions, I want to select sda5 (the boot partition) as the “Device for boot loader installation”, but in the drop-down menu, sda5 is not an option! I can choose any of the windows partitions (sda1-3), or sda6 (which is the root partition). What should I do?

    • Interesting.

      If you are sure that /boot was created, what is the amount of disk space allocated to Windows?

      • @finid
        I got it working, although it was a strange work-around. I think I essentially “tricked” the ubuntu installer into putting the boot partition on the list by first creating the boot partition (sda5), then creating the root partition (sda6), then deleting the boot partition and re-specifying it. That last step of deleting the boot partition and then re-specifying it ended up switching the names, so now my boot partition is sda6 and the root partition is sda5, even though the sda6 block is loacated BEFORE the sda5 block on the disk (verified by looking at the start/end values of my partition table). This little switcheroo tricked the drop-down menu into letting me select the boot partition (sda6) as the device for the boot loader installation. It works, and I am happily posting from my computer that will dual-boot windows7 or ubuntu12.04. Thanks!

  10. This was immensely helpful. Thank you very much!

  11. Great tutorial. I usually let the installer do it’s own thing but this seems a much cleaner option. One question though. After selecting Ubuntu at the windows boot screen it then takes me to the Grub screen and I have to choose which one I want to boot into again. Is this correct?

    • Yes, but if you don’t like that, you can configure GRUB, so that you do not have to see the GRUB menu.

      • Thank you for the tutorial finid but I’m kind of stuck when trying to boot to Ubuntu. I can boot to Win7 with no problem but when I choose to boot to Ubuntu 12.04 I end up on the GRUB> prompt (not the menu). Where do I go from the GRUB prompt?

        • Follow the steps in this article. If that does not work, reinstall, but it should, if you do it right.

          • Thanks for the info greatly appreciated – was looking at complex UEFI BIOS issues and this simple solution was a great relief!

          • I tried following the steps in that link, but it doesn’t seem to apply. I end up with a grub> prompt, not a grub2>. An ls produces nothing that is shown in that article. Seems like I am getting grub installed, versus grub2. I specifically selected grub2 using EasyBCD.

          • On the Add New Entry tab of EasyBCD, select GRUB Legacy instead of GRUB 2. That should fix it. Don’t have an explanation, but that is what seems to work.

          • And should I specify a path, or allow it to find it automatically? I have gone thru re-installs many times now, so quite frustrated, lol! When I enter ls at the grub> prompt, I end up with what looks like stuff on my C: drive (users, Windows, Program Files, etc.). It doesn’t show any of the linux file systems (sda). I only have one drive in the system, and it is configured just like in your tutorial (ie. sda5/6/7).

          • Different, but still no succss! With Grub legacy, I have gone thru just about every combination of install point and whether to use EasyBCD’s version of Grub. Either get a very DOS looking screen indicating failure to load, or just a flashing cursor. One screen shot that would be useful is the View Settings, after you have added the new entry. Mine specifies C: as the Drive and bootloader path of \NST\AutoNeoGrub0.mbr. I noticed that a NST folder was created on my C drive at some point, but nothing in it is visible to windows.

          • Just an update on my lack of success. 😉 It looks like the machine is loading Grub, instead of Grub2. So if I try and debug grub issues using the steps outlined in the external link above, all the commands are not supported (ie. the command linux is not available in Grub, only in Grub2. I used the command kernel instead). Nevertheless, I was able to replicate their instructions, but it will still error out.

            I am wondering if the problem is that I have UEFI BIOS on my GA-Z68X-UD3 motherboard? I read that Grub2 supports UEFI. I just can’t figure out why Grub2 isn’t being called, as it should be installed by Ubuntu.

  12. Hi,

    thanks for this very good tutorial. I was into my third day of trying to get Linux Mint installed and working alongside Windows 7, and your tutorial helped me finally get it to work (if not perfectly..yet).

    For the benefit of anyone else tearing their hair out with dualboot issues:

    I have an 64 GB SSD that hosts the Windows 7 OS. In addition to that I have 320 GB and 1 TB drives.

    I initially tried to install Linux Mint to a an empty partition on the 320 GB HDD (in Windows this would have been I drive), with boot, root, home and swap partitions, just as outlined here. I then used EasyBCDEdit as per instructions in another tutorial (sorry don’t have the link), but could not get Windows Boot Manager to load Linux Mint. And after finishing all the steps in your tutorial, I had this same problem. At boot time I would be presented with two choices, WIndows and Linux Mint, but when selecting Linux Mint I got the following error message:

    Try (hd 0,0) NTFS5: No Ang2
    Try (hd 0,1) NTFS5: No Ang2
    Try (hd 0,2) Extended
    Try (hd 0,3) Invalid or null
    Try (hd 0,4) EXT2:

    From (hd 0,2) onwards those are the partitions created in this tutorial then. Swap does not show at all.

    I eventually got Linux Mint to load by selecting Grub (legacy) and manually selecting the boot partition under “Device” in EasyBCD. BTW I had created a 500 MB boot partition for Linux and it showed up as (Partition 3 – Linux 476 MiB).

    Now I first get the Windows Boot Manager, then the Grub loader after that….sure I will find the solution to this yet, but right now I am just happy to get Linux Mint to load at all!

    BTW, Windows 7 freaked out a bit after I repartitioned the C drive and formatted part of it as Ext4 – I was prompted to run a consistency check. It took perhaps 5 minutes to execute and on seems to have been a one-time thing.

    Many thanks again for the tutorial. Now on to exploring Linux, newbie as I am to it…! :-)

  13. Great article, but I am stuck at Installation type step:
    Installed Win7 on Dell Optiplex-790, it has created a 100MB boot partition and next to it an NTFS one for Win7, left 60GB free space for Ubuntu at the end of the disk.
    Rebooted with Ubuuntu 12.04, got the first and second screen, then when clicked on continue, it does not seem to be able to see the free 60GB space and the partition selection window is flat empty showing the /dev/sda only as selectable. Not sure what causes it. Any advice would be greatly appreicated.

    • At that step, click the Something else option. That should take you to the Advanced Partitioning Tool. You should see all the partitions on the disk. From there, you can start creating partitions for Ubuntu.

  14. As i told u Finid, i got new lappy from Dell. 4gb RAM, I5 3rd gen processor, AMD G.Card 1gb 7670M. Initialy 2 partitions C: (275 gb, win7), D: (6xx gb, empty space) of 1TB HDD. So i installed ubuntu 12.04 (64 bit) in the 6xx gb space after selecting option ‘Install ubuntu alongside win7’. At booting i am getting ubuntu OS selection Menu. Things going fine yet :). Your tutorial was a great help and presentation is awesome. Thnx :)