Exact matches only
Search in title
Search in content
Search in posts
Search in pages

How to dual-boot Ubuntu 12.04 and Windows 7

I am reading page: 1 2

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

I am reading page: 1 2

Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Digital Ocean SSD VPS Cloud Server droplets

Digital Ocean is a VPS/Cloud hosting provider. For just $5 per month, you can get yourself a Cloud server with 512 MB of RAM, 20 GB super-fast SSD, free snapshots, plus backups for a minimal fee. All via a simple graphical interface.

And by signing up with this referral link, you can help support this website.

If you are reading this, your ad could also be occupying this space. Contact us to make it happen.

If commenting on this article is closed, please post your comments at forum.linuxbsdos.com.

562 Comments

  1. Nim says:

    After all these steps, can I create an additional partition with the rest remaining disk space in order to easily share files among my two Operating Systems? If yes, what format is suggested for this purpose?

    My plan is to have /home partition around 30gb just for small files and application’s settings on ubuntu, 100gb for Windows partition just for applications (and small files as well) and a bigger “autonomous” partition of around 300gb.

    thank you

  2. Steve says:

    I’ve already installed, formatted, reinstalled, U12.04 & Win7 twice each so far this weekend, and expect to do so at least (hopefully st most) once more this evening.

    I have UEFI and it is kicking my butt.

    Before I go through the process described on this page – does anyone here know if this guide will work with a UEFI system?

    (EasyBCD, for example, will not, and will screw up the boot infrastructure on your UEFI hard drive – I’ve just lived that.)

    • finid says:

      I haven’t tired this on a uefi system, but will sure like to.

      What is the brand of HDD you are using?

      • samski says:

        hello,
        i tried to install ubunto on my uefi based lenovo s205 several times and i always get the same grub4dos thing, so steve if you have found a solution for this issue please share it with us to complete this wonderful tuto.
        ps.: thx finid for your reply on my last question. the article you gave me helped me really to understand what i am doing.

  3. markd says:

    I just followed this tutorial step by step and when I rebooted it went to what I think was the Grub. In other words windows did not boot up, but instead I got a a list of about 7 selections… (two of them pointing towards windows 7 of all things..) both windows and Ubuntu seem to boot fine, but it appears that I’m using grub instead of windows :( Any ideas? The only difference as I went through the process is that my windows install had three partions already on the hard drive, not two as is your case. I’m going to try and wipe the drive and start over fresh and see If I can get windows to install without the third partition.

    • finid says:

      That just means that you managed to install GRUB in the MBR, rather than in the boot partition of Ubuntu.

      • markd says:

        Thanks. Everything is working perfectly now. Dual boot on a laptop!!! The first time through I didn’t use the dropdown menu, and had selected sda5 in the same method as earlier. However, upon a second more careful reading I caught my mistake. Thanks.

  4. ballakanzri007 says:

    Hello everyone and thanx a lot for this excellent tuto!
    Actually I have a problem in creating partitions! it takes long long time to resize C parttion (sda2) it just like forever!
    is it the same for all or just me?
    thanx for any help or hints!

    P.S:the tuto is so clear just need some informations about how much time takes a step or another… we can call that “installing circumstances” hehehehe

    • finid says:

      Depending on the size of sda2, it shouldn’t take more than 1 minute. So if it is taking “forever,” something else might be going on. What is the size of the partition?

      • ballakanzri007 says:

        Thanx for fast reply!
        it’s OK now! I am in the easyBCD now! try to download free version and still waiting for link or email from them!
        thanx a lot again! you are the best!

        • finid says:

          Thanks for the kind words.

          On EasyBCD, you do not need to wait for them to send the download link. Just visit this page, scroll to the bottom of the page. Type in your name and email in the specified fields and click the Download button. That is all it takes to download the free edition of EasyBCD.

          • ballakanzri007 says:

            ok Guys! I have full working windows 7 ubuntu 12.04 dual boot thanx to you!

            I couldn’t download EasyBCD from home page so I did it from somewhere else without email or anything else…

            after installing ubuntu and restart to windows 7, windows goes to trouble shooting and did some recovery stuff…
            I was affraid that my data is lost but finally i found everything is ok!

            thanks a lot guys especially that genius^
            are pushing the limits like me? I am trying windows ubuntu 12.04 hackintosh lion 10.7.3 multiboot!
            hahahahahaha

  5. Akhil says:

    I followed all the steps correctly. but when i select the linux in boot menu i get something like:
    ” variables
    starting cmain…”
    Thats it. it stays there. how to correct this?

  6. Emanuele says:

    Hello,
    I have more or less the same setup you are describing in this tutorial. The main difference is that I have two Hard Disks.
    I have installed Windows 7 in the second one (sdb). It put a 104MB MBR partition in sda.

    When I installed Ubuntu 12.04 I used the remaining space in sda to build a 512MB Ext4 partition for /boot, a swap partition, and I allocated the rest for /.
    Then I set the device for boot loader installation to the partition set for /boot, and installed everything.

    The computer restarted on Windows as expected. I went for EasyBCD and I added the GRUB 2 option.
    When I restart the computer I have the correct menu to select among the two OS.

    It boots correctly selecting Windows.
    If I go for Ubuntu, this is what I got:
    Try (hd0,0): NTFS5: No ang0
    Try (hd0,1): Extended:
    Try (hd0,2): invalid or null
    Try (hd0,3): invalid or null
    Try (hd0,4): non-MS: skip
    Try (hd0,5): Extended:
    Try (hd0,5): EXT2:

    And it stays stuck there. With slightly different setup (I have done a thousand attempts, I can’t remember the exact mixture), instead of this error it goes to GRUB4DOS.
    I have not yet achieved the right formula to go to the intended Grub :)

    • finid says:

      When dual-booting on 2 hard drives, you want to confine each OS to its own disk. That will save you a lot of headache. And if done correctly, you can even do without EasyBCD.

      Try this:

      Windows on sda

      Ubuntu on sdb

      Just make sure that GRUB is written to the MBR of sdb, not to that of sda.

      Then if you want to boot into, just access the boot menu and select sdb.

      • Emanuele says:

        Ok, I will try it. Thanks a lot!

        Btw, before re-installing everything, doing it in that way the computer would boot in Windows if I do not push anything, right?
        Is it an option I can switch in BIOS?

        If it is not, is there a way to say to Windows to move everything to sdb? Installing it to sdb he still put MBR on sda. I use Windows rarely, so I would prefer the autostart on Ubuntu.

        • finid says:

          Yes, the PC will boot into Windows if you do it as suggested. But you can always change the boot order in the BIOS. If that proves too much trouble (it really isn’t) you can use EasyBCD to add an entry for Ubuntu in Windows’ boot menu.

          • Emanuele says:

            Ok, it does not work. Sorry for the extended trouble!

            I have installed Ubuntu in sdb (Disk 0 accordingly to Windows) and Windows 7 in sda (Disk 1 accordingly to Windows).
            I have 3 partitions in each disk:
            – in the Ubuntu one there are the two Ext4 partitions for /boot and /, and a swap partition.
            – in the Windows one there are two small partitions built by Windows during the installation, and the main partition.

            With the previous setup (Windows on disk 0 / sdb but his boot partition in sda, Ubuntu in the remaining part of sda) only windows was working. There were no way to start Ubuntu.

            With this configuration (Windows on disk 1/ sda, Ubuntu on disk 0/sdb), only Ubuntu starts. If I ask him to start from disk 1 via BIOS, Windows crash. It goes for repair, it does not work. Nothing to do.
            Starting Ubuntu, everything seems fine.

            Later I tried to reinstall Windows, to see if it could correct the problem. I deallocated the three partitions on disk 1, and started the install from scratch giving him just “Disk 1, unallocated” as a direction on where to install. Now, neither Windows nor Ubuntu are working.

            I have a motherboard P8H61.
            What does EFI means? I have read in other websites that this could be the problem, can it? Can it be related to my motherboard?

            I have installed dual boot XP / Ubuntu on many different machines, with one or two hard disks, and I had never had any problem, this is the first time I have all this troubles: I am not sure if it is Seven, the new Ubuntu 12 or the new motherboard.

          • Emanuele says:

            Ok, after more attempts, I still can not do it.

            The process is always the same:

            I install Windows, it works.
            Then, I install Ubuntu. Ubuntu works. Windows does not work anymore, it asks for repairing. Repairing does not work either.

            I have to format Windows partitions and install Windows again. Now it works. However Ubuntu does not work anymore.

            Re-Installing Ubuntu at that point does not help either, it is not possible to boot from Ubuntu.
            Windows keep working.

            Using EasyBCD, Grub 2, it does not work either. The “ubuntu” option send me to Grub4dos. In C: I have ANG0 and NST/AutoNeoGrub0.mbr

            To start Ubuntu at that point I need to format everything and start again.

            This is true both if I put one OS per Disk or if I split them among different disks, there is no way (and no differences)

            Is it possible it is related to UEFI option? There are a lot of issues related to my motherboard with Ubuntu 12…

            Usually dual booting Win/Ubuntu is so easy, this PC is driving me mad!

          • finid says:

            Well if you have 2 hard drives, then you do not need to use EasyBCD. Just do this:

            Windows on sda

            Ubuntu on sdb

            Just make sure that GRUB is written to the MBR of sdb, not to that of sda.

            Then if you want to boot into, just access the boot menu and select sdb

          • Emanuele says:

            That is what I did, but it does not work. I have Everything about Windows in sda, and Everything about Ubuntu in sdb.
            Before installing Ubuntu, the sdb disk was completely unallocated, I built the three partitions and it worked.

            However, Windows stopped working. Reinstalling Windows (always only in sda, I unallocated all sda and then asked Win7 to install itself in that disk), Ubuntu stopped working. Even if I did not touch his partitions.

            Now, if I set the Ubuntu disk as the first bootable source in the BIOS, it jumps it and go to the second one, Windows. That’s why I tried, as a second chance, EasyBCD from Windows, but it does not work either.

            I have done this a lot of times on different computers, one major difference is that I have this “UEFI” label on my SATA disks with this motherboard (p8h61), I am not sure what it means. The other major differences are that in the previous attempts I was using XP and Ubuntu 10.

          • finid says:

            Then this is likely a mobo issue.

  7. samski says:

    Hi,
    I did everyzhing just as in your Guide, made a 500mb ext4, set it as bootloader partition, but I got the same Grubdos error. I tried a clean installation but still get that error.
    I have sd1 for Win boot, sd2 as C:, sd3 as D:, no sd4, sd5 boot, sd6 for Ubuntu sd7 and sd8 for home and swap, the 1st and 2nd partitions formated with windows, all other with gparted from ubuntu as logical driveres.
    any hints about the reason for this error??
    whatever i try, sd4 still missing.

    • finid says:

      sd4 is not missing. It is an extended partition.

      Regarding the error, I think it may have something to do with EasyBCD, but not totally sure. Attempting the same with Linux Mint 1 to see if I get the same error.

      Btw, you might want to read this article for an intro on partitioning in Linux.

  8. Anton says:

    PLEASE HELP!!!

    WHEN I TRY TO BOOT INTO UBUNTU 12.04 AFTER DOING ALL THE STEPS, I GET THIS —–>>>

    GRUB4DOS 0.4.5b 2011-11-27, Mem: 628K/2046M/0M, End:35560D

    [Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename.]

    grub>

    PLEASE HELP DON’T KNOW WHAT TO DO ANNY MORE

    • finid says:

      Be sure to remove the installation CD, reboot, then see what happens.

      • Anton says:

        I USED A LIVE USB, AFTER THAT REMOVED THE STICK. I REBOOTED A COUPLE OF TIME STILL WITH NO LUCK, MAYBE TRY A FRESH INSTALL????

        • finid says:

          Please disable Caps Lock.

          If you can log into Windows, try redoing the section of EasyBCD to add an entry for Ubuntu in Windows boot manager. Before that, ensure that GRUB is installed in the proper location, which should be the boot partition.

          • Nick says:

            I have the same problem as Anton. I have redone EasyBCD multiple times, as well as redoing the entire installation of Ubuntu. How could I check to make sure GRUB is installed in the proper location? Other than selecting sda5 from the drop down menu? Any help is appreciated.

          • finid says:

            I’m beginning to think the problem could be with the version of EasyBCD we are using. I’ll have to look into this further.

    • franco says:

      Did you solved that problem?
      I have the same.

      • Anton says:

        the problem was solved, i was installing from usb,
        i had to remove the usb before rebooting. had to use the reset button. after that booted into windows, changed the boot settings in easyBCD, and it worked. but i had to do a fresh install of ubuntu,

        if using a cd to install ubuntu, the media ejects before the reboot.

        so thanx a lot Finid

        that seemed to be my problem.

        hope this helps

  9. Hello.
    Thanks for your nice tut.
    Thus, on many/most Windows-boxes that come preinstalled the harddisk looks like this:
    /dev/sda1 (NTFS, Windows7 reserved, boot)
    /dev/sda2 (NTFS, Windows7 system)
    /dev/sda3 (NTFS, Windows7 recover)
    /dev/sda4 (NTFS, Windows7 some kind of diagnostic-partition)
    This is shown by PartedMagic on my system.
    So three more partitions (even only one) are not possible.
    Am I right, that the only solution would be to re-install Win7 (if you have an install-disk) in only one partition?

    • finid says:

      Yes, you are right. Maximum 4 primary partitions have been used up. If that is the default partitioning scheme of OEM Windows, then your best option is to reinstall, if you have a Windows installation CD.

      The other option, is to consider wiping one of the partitions. What, for example, have you done with the diagnostic partition? If this is a partition you can do without, it is the best candidate to wipe and reuse.

      • Hi.
        The “Diagnostic” partition is only about 1GiB in size.
        Don’t know, what this is for at all. Gparted says ist’s marked as “diag”…

        Some time ago I wanted to make a dual-boot system from another Win7 PC (with less primary partitions), re-sized the windows-part and deleted a partition which I thought was unneccesary…
        After installing Ubuntu (which went allright), the Win7 installation refused to boot because it missed just that one partition.
        I had to face it: No more Windows, just Ubuntu on that machine…
        I just want to mention, that Win7 isn’t that frugal as Windows XP once was, when it comes to partitioning (resizing, deleting, and so on).
        Maybe this is only due to those OEM-installs.

        • finid says:

          Those are most likely just OEM installs. By default, Windows 7’s installer creates only 2 partitions:

          sda1 – system reserved

          sda2 – data partition

  10. lewac says:

    a coupla mentions here. first off its always recommended to install /home to a separate partition. you also need / (root) and swap. nowadays you oughta be using ext4 for any linux distro. its proven over time to be very robust. also try to put swap on a separate physical drive if you have one installed. as a guide swap should be about twice the size of your physical memory… 6gb on a 32 bit system should suffice.. 16gb on a 64 bit box.

    I also recommend that you install grub2 by default. and then make a copy of the 1st sector of the boot partition. this preserves grub2’s mbr… just in case you need to restore it at some future time. in fact on a sys with more than one HD you should make copies of those MBR’s as well.

    another nice thing about grub2 is that it is FULLY customizable. google on “grub-customizer” for howTo’s. quite frankly like most things in linux it makes the windows boot loader look like a turd in comparison.

    • finid says:

      That “swap should be about twice the size of your physical memory” is old. Nobody follow that anymore. Can you imagine a box with 16 GB of RAM, that would 32 GB of Swap space.

  11. SysKoll says:

    Excellent tutorial. As more people are coming to me with Windows 7 machines they want to dual boot, I was wondering if there was a way to avoid overwriting the MBR with Grub.

    • lewac says:

      you can opt out of installing grub during the ubuntu install. however I’m really wondering why grub2 shouldn’t be your primary loader to begin with? one way to avoid a windows overwrite on a re-install is to make a copy of the 1st track of the boot drive. that way if anything wipes the mbr you can bring it back from a linux boot stick (or CD).

  12. ben says:

    I get this when I install GRUB either at /sda or /boot:

    I have no idea what is wrong or how to fix it.

    GRUB4DO 0.4.5b 2011-11-27, Mem: 630K/318M/496M, End:35560D

    [Minimal BASH-like line editing is supported. For the first word, TAB lists possible command competions. Anywhere else TAB lists the completions of a device/filename.]

    grub>

  13. Ravindra Siwach says:

    Thanks for this.. Seems like the issue was caused by chosing a ext2 file system for /boot.. cuz when i installed using ext4 it worked.. a clean install no problems… Thanks again

  14. David says:

    Finid, is there a good way to set up full-disk encryption on a dual-boot (Win 7 & Linux) laptop?

    • finid says:

      If you are thinking about full disk encryption on the Windows side too, I don’t think that’s possible, but I could be wrong.

      On the Linux side, it depends on the distribution you intend to use. What’s your distro choice?

      • David says:

        I believe that Truecrypt can be used to encrypt a Windows drive starting at the bootloader, but don’t know how that would affect a dual boot with Linux. (I’m using the Windows bootloader with EasyBCD. Your tutorials are the best — thank you!)

        Right now I’m using Linux Mint 11, but will probably switch to 12.04 Ubuntu or Kubuntu soon (I like the way global menus save vertical space on a small laptop screen, and Kubuntu is the only KDE distro I’m aware of that can be set up that way), and I know that the alternate installers offer full encryption (wish I could use LVM, too).

        One complicating factor is that I have an NTFS partition set up to hold all my data, so I can read it from both OSs.

        • finid says:

          How you setup one end of a dual-boot system does not affect the other, in terns of booting. So, if you can configure full disk encryption for Windows, it will not affect how you setup the Linux side.

          If you can use Truecrypt “to encrypt a Windows drive starting at the bootloader”, you can also use it to encrypt the shared ntfs data partition. The only thing that will happen when you attempt to access it from the Linux end, is you will be prompted for the encryption passphrase.

          As for LVM, yes, you can configure LVM on any Ubuntu-derived distribution that also has an alternate CD/DVD installation image.

          • David says:

            Thanks, that’s a big help. Maybe I can get my disk fully encrypted after all.

            I know I can use LVM with the alternate installer, but I can’t do it on the same disk as a Windows installation that uses conventional partitioning, can I?

          • finid says:

            Whatever you do on one end of a disk in a dual-boot configuration does not affect the other side. So nothing stops you from using an LVM-based disk partitioning scheme on the Linux side when dual-booting with Windows or any other OS. As an example, see this tutorial.

  15. kwangil says:

    so, the only different with my wrong installation is just the size of /boot partition?…

    I used 200MB for /boot partition and ext2 or ext4, both show me the fatal error message when installing grub in /boot :(

    Should I have to use 500MB for /boot partition? …

    It’s really fine to cut less then 1GB of hard dirve away. I just feels quite rediculous that almost all of the installation guides of the UBUNTU said that “100MB of /boot partition is okey!” …

    • finid says:

      Yes, 100 MB for /boot should be enough and I do not think that the disk space allocated to it is the cause of the error you are seeing, but you never know, stranger things have happened. In any case, let me know if it worked for you or not.