Partner links

How to dual-boot Ubuntu 12.04 and Windows 7

Windows 7 Dual-Boot Boot Menu

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

Share:

Facebook
Twitter
Pinterest
LinkedIn

Partner links

Newsletter: Subscribe for updates

562 Comments
Inline Feedbacks
View all comments
Nim
Nim
11 years ago

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

Steve
Steve
11 years ago

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.)

samski
samski
Reply to  finid
11 years ago

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.

markd
markd
11 years ago

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.

markd
markd
Reply to  finid
11 years ago

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.

ballakanzri007
ballakanzri007
11 years ago

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

ballakanzri007
ballakanzri007
Reply to  finid
11 years ago

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!

ballakanzri007
ballakanzri007
Reply to  finid
11 years ago

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

Akhil
Akhil
11 years ago

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?

Emanuele
Emanuele
11 years ago

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 🙂

Emanuele
Emanuele
Reply to  finid
11 years ago

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.

Emanuele
Emanuele
Reply to  finid
11 years ago

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
Emanuele
Reply to  finid
11 years ago

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!

Emanuele
Emanuele
Reply to  finid
11 years ago

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.

samski
samski
11 years ago

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.

Anton
Anton
11 years ago

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

Anton
Anton
Reply to  finid
11 years ago

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????

Nick
Nick
Reply to  finid
11 years ago

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.

franco
franco
Reply to  Anton
11 years ago

Did you solved that problem?
I have the same.

Anton
Anton
Reply to  franco
11 years ago

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

Edgar Hoffmann
11 years ago

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?

Edgar Hoffmann
Reply to  finid
11 years ago

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.

lewac
lewac
11 years ago

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.

SysKoll
SysKoll
11 years ago

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
lewac
Reply to  SysKoll
11 years ago

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).

ben
ben
11 years ago

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>

Ravindra Siwach
Ravindra Siwach
11 years ago

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

David
David
11 years ago

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

David
David
Reply to  finid
11 years ago

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.

David
David
Reply to  finid
11 years ago

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?

kwangil
kwangil
11 years ago

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!” …

1 2 3 11

Get the latest

On social media

Security distros

Hacker
Linux distros for hacking and pentesting

Crypto mining OS

Bitcoin
Distros for mining bitcoin and other cryptocurrencies

Crypto hardware

MSI GeForce GTX 1070
Installing Nvidia GTX 1070 GPU drivers on Ubuntu

Disk guide

LVM
Beginner's guide to disks & disk partitions in Linux

Bash guide

Bash shell terminal
How to set the PATH variable in Bash
Categories
Archives