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. Hello finid,

    Thanks a lot for these extremely useful tutorial. I have a few questions specific to my case:

    1. My Windows machine already has 4 primary partitions

    /dev/sda1 – SYSTEM, 301MB, NTFS
    /dev/sda2 – C:, 39GB, NTFS
    unallocated space – 242GB, NTFS
    /dev/sda3 – HP_RECOVERY, 15GB, NTFS
    /dev/sda4 – HP_TOOLS, 2GB, FAT32

    I want to allot 40GB partition space for Ubuntu 12.04, which includes /boot, / and swap. I wish to have a partition of 200GB shared amongst Windows and Ubuntu. How would you suggest me to proceed with the Ubuntu installation?

    2. While trying to install Ubuntu from the Live desktop, it asks to un-mount /dev/sda so that the unallocated space can be used for partitioning. Should I go ahead with that?

    Thanks in advance!

    • Because the system already has 4 primary partitions on it, you are not going to be able to create additional partitions. The MBR partitioning scheme, which I’m sure it is using, only allows max. 4 primary partitions. See guide to disks and disks partitions in Linux for more on this topic.

      But how did 242 GB of unallocated space came to be nestled between sda2 and sda3?

      Note that even if you reboot, that 242 GB of unallocated space will still be usable, for the reason given earlier.

      Your only option is to delete sda3 or sda4, then the 242 GB of unallocated space and the space freed up by deleting either partition will be combined. That can then be used to create the partitions for Ubuntu.

      If you have not used HP_RECOVERY and HP_TOOLS by now, you probably wont use it.

      • Thanks for quick reply finid!

        Actually, I have bought this new machine HP EliteBook 8540w yesterday. The default partitioning had C: with 242GB unallocated space incorporated in it. Since I wish to have a dual boot configuration, I used Easeus Partition Master to shrink the C: to 40GB.

        I did not understand what you meant by “Note that even if you reboot, that 242 GB of unallocated space will still be usable, for the reason given earlier.” Could you please explain this again?

        Easeus Partition Master allows to move the partitions, so that the unallocated space will be shifted to the end. It also allows to convert the primary partition to logical. But people recommended not to touch these HP partitions at most of the places on Web. But I think I can delete the HP_RECOVERY partition once I have created the recovery discs.

        Also, how would you suggest to proceed regarding sharing a common partition of 200GB among Windows and Ubuntu? Should I format /home to NTFS? And not encrypt it?


        • If it’s a brand new HP machine the odds are very great that it uses “gpt” partitioning, which does not have the four-primary limit. If you have a “live CD” you can run a test to tell for sure; the details are at and you should read that page before making any changes. You may be able to install Linux without deleting any existing partition, but there are a few details to deal with along the way…

          • If the partitioning scheme were GPT, then there should been a small (about 1 MB) unformatted partition before the system partition. The BIOS_boot partition, But I could be wrong.

        • Go ahead and reboot, and see if the installer will be able to use the unallocated space. If it is able to, then you are dealing with a GPT partitioning scheme, which I doubt. Please read the article I recommended in the previous comment. It tells you all you need to know for this type of task about partitions and partitioning schemes.

          • Jim, finid,

            Thanks for your replies!

            This is indeed an MBR type partitioning. The Ubuntu installer show unallocated space as unusable!

            I will delete the HP_RECOVERY partition and then merge that space with the unallocated region. This should free up one slot for a primary partition. Now the only question remains, how to share a partition among Windows 7 and Ubuntu 12.04. Is sharing /home of Ubuntu by making it NTFS with no encryption a good idea?


          • See Jim Kyle’s response.

            You can’t make /home an NTFS partition. It has to be stamped with a Linux filesystem. You can create a shared NTFS partition at the end. See this link for some useful articles.

          • No reply button on the OP’s latest so I’m replying here instead.

            Make the 242-GB space an extended partition, then create logical partitions inside it per finid’s outline.

            The /home partition must be a Linux type; NTFS won’t work for it. You can create a large NTFS partition for shared stuff, and symlink folders from $HOME to it.

          • Right. I’ve also realized that my system has UEFI firmware. I just had a look at, where you did not create the /home partition at all. What are the consequences of this? Can I symlink everything to the shared partition as Jim suggested? Or is it recommended to have a small /home partition anyway?

            Cheers for all the replies!

          • Everything worked perfectly! Thanks again finid and Jim!!

  2. Pingback: Download Windows 7 for Linux - Black Ops 2 Forum - Call of Duty: Black Ops 2 Forums

  3. Hello, thank you for this great guide.

    I have a little question:
    When I chose ubuntu from the win7 boot menu it load the ubuntu boot menu and I have to chose again, is this normal?
    if yes how can I disable the ubuntu boot menu so it load ubuntu automatically after I chose ubuntu in the win7 boot menu.

    • That’s normal. To disable it, boot into Ubuntu, then edit /etc/default/grub. Change GRUB_TIMEOUT=10 to GRUB_TIMEOUT=0. It should be line 8 of that file. Run the following command afterwards: sudo update-grub. This article shows how it’s done.

  4. Hi there. Thanks for putting this up. I followed your instructions here, and when I go to boot Ubuntu from the windows bootloader, I just get the grub command line. I tried to load linux from there (trying each one of the linux partitions, just in case), but nothing worked. Any idea what I might have done wrong? Thanks

    • More info about your hardware, HDD and how many partitions there are would help understand your situation better.

      • I had tried it several times with several different partitioning schemes on a single 1tb hdd. In the end, I used boot-repair (, and that did the trick. It boots to GRUB rather than the Windows bootloader, so I’ll probably have headaches if I want to upgrade Windows, but my primary goal was to just get a working dual-boot scheme, so I’m content.

  5. Great walkthrough, clean and direct.

    May I could ask you a quick question, just to be safe?

    I want to install Ubuntu 12.04 on a pc with Win 7. However, Win 7 was installed over a previous Win XP (dumb me), and there’s no Windows boot partition. Should that result in any problems?

    Since I was planning to do this when I had the time, I had previously left the partitions ready for Ubuntu before installing Win 7. So the partition table is actually:

    sda1: 40,0 GB – ntfs (Windows 7 system AND boot)
    sda2: 500 MB – ext4 (empty, ready for GRUB)
    sda3: 40,0 GB – ext4 (empty, ready for Ubuntu /root)
    sda5 (logical): 2,0 GB – swap (empty…)
    sda6: 300 – ntfs (Data partition)

    I am hoping I can proceed installing ubuntu with you method without worry.

    Thanks a bunch!

  6. hello sir,

    as per ur guide I changed the partition size in /dev/sda2. But the free space that was to be used to create partitions is listed as “unusable” and am not able to create any more partitions(the “add” option is inactive). Moreover i can’t even revert my action and the free space is of about 13.8GB.

    please help

    • The free space you freed up is listed as “unusable,” because there are 4 primary partitions on the system. See this article for more on this topic. You need to delete one of those partitions, so that it can be used for Linux.

      Your machine has an OEM installation with recovery partitions, right?

  7. Hello Sir,

    I am about to install UBUNTU 12.10 64 bit on my PC having windows 7 32 bit already installed ….

    Since I have 3 partitions made on windows 7 already

    So according to your post I shouldn’t have sda5 as my boot menu , instead of that it should be sda6 right ??

    Or any partition with /boot written on it right ..??

    Now my 2nd question… I have 165 unallocated space for UBUNTU …

    How should I divide my space if I plane to install many apps and will of course be updating regularly ??

    PLease sir reply ASAP ..

    Thank YOu

    • If you have 3 existing partitions fir Windows, and I’m assuming that they are all primary partitions, all your Ubuntu partitions will be logical partitions, so the first Ubuntu partition will be sda5. Ubuntu’s installer will automatically create the extended partition behind the scenes, so you will miss that part.

      For 165 GB of disk space, 500 MB to /boot, about 8 GB to /, 4 GB to Swap, and the rest to /home.

  8. Hello,
    thank you for this great (!) step by step instruction. One of the best I have ever seen.
    Yet I have a question: I want to use an extra data partition.
    My (only) hard disk is 285 GB, I imagined to partion it way like this:
    30 GB Win7 NTFS; 220 data NTFS when installing Win7 and the rest being done by the ubuntu installer. Would this work?
    And do I still need the home-partition? Because I want to save all my data on the data-partition.
    I know I can access the windows-data out of ubuntu and also write there. But would it have the same speed?
    Crap, my English is bad, I hope, you still get what I mean.
    Thanks in advance for your help and again my appriciation for this great work.


    • with a disk of that size, you may run into some problems booting ubuntu, if /boot is too far from the first sector of the disk. It might work, but the safest route to go is this:

      install windows normally, but do not create NTSC data partition until after ubuntu is installed. So the ntfs data partition goes after windows, and it has to be created from windows.

      you do not have to have a separate home partition. A home folder will be created under root,if you do not.

  9. i guess root(Mount Point: /) should be Primary Partition and not Logical .

  10. i follow your step and i install Ubuntu and use easyBCD but when i boot Ubuntu 12.04 i get a message
    GRUP4DOS 0.4.5c and a ( grub> ) command what to do and what is this message ???

  11. Excellent tutorial on the dual boot.

    Odd request:
    I would like to quad boot unbantu 12 with XP, Vista, and Win 7. What would be the correct order of OS installs. I have win7 currently on an SSD. I have a empty 300Gb HD where I would like to put XP, Vista, and Unbanu, and a 2nd win7 install. I have a 3rd HD for Data only. I have a drive back image of Win7 from the SSD.

    Your knowledgeable input would greatly appreciated.
    Thanks :)

  12. I am attempting to install on a Lenovo ultrabook with Windows 7 pre-installed–booting from a CD on external reader.

    The install process SKIPPED the screen where it says you already have Windows 7 installed, where you tell it you want “Something else.” It went directly to the next screen, on which NO partitions were shown–implying it does not know Windows 7 is already there.

    I aborted the install, and booted back into Win 7. What is going on here?


    • Good question.

      The installer shouldn’t skip any step. Try it again, and post an update.

      • Tried it a few times now, same results.

        Noticed that the “Device for boot loader installation is “/dev/sdb” (no other info), NOT /dev/sda, and I can’t change it.

        Further info:

        I got into disk management in Windows 7. It shows two “disks”: Disk0 and Disk1.

        Disk0 is 8.0 GB and is described as a “Hibernation partition.”

        Disk1 has four partitions:

        1. “SYSTEM_DRV”, 200MB, NTFS, “System, Active, Primary Partition”
        2. ” Windows7_OS (C)”, 402GB, NTFS, “Boot, Page File, Crash Dump, Primary Partition”
        3. “LENOVO (D)”, 25GB, NTFS, “Primary Partition”
        4, (unnamed), 19.34GB, “OEM Partition”

      • Further info:

        I posted this same question on Ubuntu forums, and received the following reply:

        In this type of setup, usually both disks are set up in sort of a raid. I guess that’s why it wasn’t detected properly.

        On top of that, it seems Disk1 already has the maximum 4 primary partitions created, so you can’t create any more partitions.

        You can create a set of recovery DVDs from the recovery software, after which you don’t need partition #4 and can delete it and use that space.

        But in any case you need to consider whether you will break the “connection” between the disks or not. From cases reported here, it seems you will not be able to install unless you break them up. But it might be different with your machine.

        (end of Ubuntu Forum reply)

        I do remember when I booted into the Ubuntu install disk, the disk descriptions included the word “RAID.”

        The part of the Ubuntu forum reply about “breaking the connection” between the disks is completely outside my experience and knowledge, and makes me quite hesitant to proceed.

        Can you shed any light on this? Thanks.

        • Even on systems where the alowed number of primary partitions is maxed-out, the installer will allow you to resize the C drive, if it has enough space, so there much be some type of setting in the BIOS that is causing this issue.

      • Further info from Ubuntu forums:

        (Begin Ubuntu forum quote)

        It seems this kind of setup is something called Intel Rapid Storage Technology, where they use the small SSD as a fast storage/hibernation disk. People with this setup have said that they couldn’t manage to install the dual boot until they deactivated IRST in windows first, then in BIOS changed sata mode from RAID to AHCI, and then removed the meta data from the disks using the dmraid commands.

        From what has been mentioned, windows will keep on working, the procedure doesn’t mess up windows. But the way it works might be little different, not using this fast storage. And on your machine it might create problems, or not. I can’t really say 100% so I can’t tell you to do this or that.
        I only mentioned what I have seen here.

        See first if this is IRST on your machine and then do some google research about the dual boot on these machines. If you like what you read, go for it. If not, sorry, it seems you have no options but to return the machine.

        (End of Ubuntu forum quote)

        So, I am now considering just returning the machine. Do you have any suggestion that might allow me to keep this laptop and use it for both Ubuntu and Windows?

        Thanks very much.

      • Finally, if I do have to take this PC back and get a different one, what can I look at on the PC in the store BEFORE I buy it, that will tell me it has what I need to be able to dual boot Windows and Ubuntu?

        Thanks very much.

        • It does look like the unit has 2 hard drives, one is a SSD, the other an HDD. And I think the disk management tool in Windows already revealed as much by listing a Dsik0 and a Disk1. So, you do have two hard drives. You can double-verify that by going into the BIOS and looking at the boot devices.

          Knowing that, do you really need to have the SSD as an “Hibernation partition”? If you don’t, and I think it is a feature you can do without, you can just go into the BIOS as was suggested in the other forum, and decouple the drives.

          Once they are decoupled, you can do a few fancy dual-boot setups with both drives. So go into the BIOS and see what the heck is going on there.

          On current PCs, you can dual-boot any Linux distribution and Windows. No special mark on the unit that will tell you that, though.

          • Well…I went into the BIOS. I can’t tell what to do.

            It does have two disks, 500GB and 32GB.

            In the configuration section it says SATA controller working mode is “RAID”.

            I have no idea how one would decouple the disks, and wondering through the BIOS has given me no clue. I had probably better just take it back to the store. Thanks.

          • The storage mode should have 3 options – RAID, IDE and AHCI. Change it to AHCI. That should take care of the problem, but you must still decide if you want to keep SSD (Disk0) or wipe it and configure both drives your way.

            I just built a unit with a setup similar to yours, so check back late tomorrow for an update.

          • Thank you, finid.

            I changed the mode to AHCI. It made no difference to the Ubuntu install–although maybe you weren’t expecting it to (because you mentioned I still have to decide what to do with the SSD).

            But Windows would no longer boot. I eventually put the storage mode back to RAID, and at least now I can boot Windows.


          • Another question–sorry to keep bothering you.

            Do you know if this storage configuration would allow me to successfully install Ubuntu 12.04 IN PLACE OF Windows 7, after which I could run Windows 7 within VirtualBox.

            I know this is off the subject of dual-booting, but it would solve my problem if it worked–I only need Windows so that I can run MS Office. I guess I would have to buy Windows, since I don’t know if I can make a copy of the pre-installed Windows and install it under VirtualBox.

            I am asking this because I don’t want to attempt to install Ubuntu, wiping out Windows, and then find Ubuntu doesn’t work and Windows is gone too.

            Thanks very much.

          • There is no reason why Ubuntu or any other distro cannot be installed, and you should be able to install Windows in a virtual environment.

  13. Thanks for the post, but i have one question. Is it possible to access the remaining c drive(here i.e.. 100GB) from ubuntu and vice versa ? If not possible how it can be achieved ?

  14. Dear Finid,
    Indeed it is a very helpful tutorial. But, I have one problem. I followed these instructions (steps) up till the restart. When it restarted though, it loaded direct to windows 7, not to Windows 7′s boot menu with two entries. So, how could I get the windows boot menu so that I can get the access to ubuntu.
    Btw, I installed 12.04.1 desktop-amd64.
    thank you

  15. Hello,

    Indeed a very helpful tutorial but my problem is still pending. Would be grateful if anyone could help me on it. Here it goes:

    I had Ubuntu 12.04 installed (with a very similar organization of partitions as described on this page). In addition to this big partition of ubuntu (including boot, root, home and swap partitions) there were several others i was using to store various non-systemic data. I decided install Windows 7 to one of those partitions.

    Of course, after the instalation, the windows were loaded automatically as if there was no other OS. Then I used this EasyBCD 2.2 to add a boot manager entry for the ubuntu. I selected “automatically locate and load” and saved the changes.

    After rebooting, the manager lets me choose to boot ubuntu, but after clicked, i get a black window giving me a bash for the grub. The line starts with grub>. And then I feel lost and don’t know what to do.

    Would be great if you could help me make the window boot manager working properly.