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
Vins
Vins
11 years ago

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 ?

Garu
Garu
11 years ago

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

Garu
Garu
Reply to  finid
11 years ago

Dear Finid,
Works perfectly!! Thank you

Lukas
Lukas
11 years ago

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.

vishal
vishal
11 years ago

thank you very much….it was very useful….step by step deep explanation with its working helped me lot….thanks again
thumbs up….:)

vishal
vishal
11 years ago

thank you very much….it was very useful….step by step deep explanation with its working helped me lot….thanks again
thumbs up….:)

tinus
tinus
11 years ago

I think I have a small problem.

I installed Ubuntu 12.04 LTS and later installed Windows 7. Of course I was so overconfident that I did NOT RTFM (Read The F*cking Manual). So, as predicted windows overrides the MBR and my Ubuntu was not reachable anymore. I then used easyBCD in windows 7 and my problem was fixed.

But…

After a week of 2 I all of the sudden get the boot selector 2 times. First is of course Windows boot selector. And when it continues to Linux, Ubuntu comes up with another boot selector.

As I explained before only Windows boot selector came up in the beginning. And I did not make any changes to either Ubuntu of Windows 7. At least not that I know of.

Is there a way to fix this? I would like to only use the Windows boot selector.

thanks in advance

Anna
Anna
11 years ago

Hi, I need help! I’m in the middle of tinkering with the partitions and wanted to create my home partition as NTFS. But the installer doesn’t provide me with that option! Should I just create boot, root and swap, leave the rest of the space unallocated, and create the NTFS partition for my data later, from Windows 7? Hope someone can help, as I created half of the partitions already… :/

Anna
Anna
Reply to  finid
11 years ago

Thank you, Finid.
Ok, I’m fine with my home directory being under the root partition. I won’t create a partition just for it. And I want to create an NTFS partition to be shared between Ubuntu and Windows, yes.
Just to be clear about the order in which to do this: within the installer, I should create boot, root and swap, leave the rest of the space unallocated, and later, from Windows 7, create the NTFS partition for the data, which will then be located at the end of the disk? Is that correct?

Anna
Anna
Reply to  finid
11 years ago

Thanks!! Off to try this now.

Anna
Anna
Reply to  finid
11 years ago

Hi Finid,
Ok, partitioning and install done, and it all went great! 🙂
I still have a question about the NTFS partition I’m going to create to share my data between Windows and Ubuntu.
See, now from Windows, the 6 partitions look a bit funny:comment image. Six primary partitions?! It’s obviously not the case, but Windows is not displaying the extended partition that must contain the 3 new logical partitions.
In this context, I’m wondering what will happen when I create the NTFS partition. Will Windows try to create a new extended partition? It can’t, there’s no space left. Will it treat it as a primary partition? Same answer! Will it call it a primary partition, but really make it a logical one inside the “invisible” extended partition? Hmmm…
So… I think I would feel more comfortable creating the NTFS partition from Ubuntu. I guess in that case, from Windows, it would end up looking just like boot, / and swap. A “fake” primary partition.
Is it possible to do that from Ubuntu? Are there any traps to avoid? What tool would you recommend? And would there be anything special to do in Windows afterwards, other than assigning a letter to the newly created partition?
Thanks a lot for your help!

Anna
Anna
Reply to  finid
11 years ago

Thanks for your answer. Yes, “partition principale” = “primary partition”.

Here’s what it looks like in GParted:comment image. So I suppose I have to make the extended partition much bigger before trying to create anything else inside of it. Can I do that from the install live-CD?

Pendragon
Pendragon
11 years ago

Ummmm…. I followed these instructions up till the “restart” (With a couple key differences in that I had already shrunk my partition in Windows and in GParted created a decent sized Fat32 partition to put files I wanted access to on both OSes.) Other than that though I just hit Install Xubuntu and follow the directions from there. When it restarted though, it loaded Xubuntu, not Windows. All the windows files are still there in their untouched partitions….. but they aren’t doing anything. Please, I really need this dual-boot for school. (Windows for the Adobe Suite, and Linux to communicate with the school’s computers.) How do I get a boot loader that will allow me to select my partition/OS when I start the computer?

Pendragon
Pendragon
Reply to  finid
11 years ago

I told it to install it to sda5, and I checked and sda5 is the boot partition.

No, I do not in fact see grub at all when I turn on the computer, it automatically loads xubuntu.

However, I found out that if I press excape when it shows the computer’s brand name, and navigate to the “boot menu” I have options for both Windows and ubuntu (although I have xubuntu, but I don’t think that matters).

I’ll assume a shell terminal is not a special kind of terminal or anything.

I have installed and updated grub via the terminal. I will be back with an update momentarily.

Pendragon
Pendragon
Reply to  Pendragon
11 years ago

Went right back to xubuntu upon reboot, no visual sign of grub.

Pendragon
Pendragon
Reply to  finid
11 years ago

There was no reply button to your other comment, so posting this here:

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
GRUB_CMDLINE_LINUX=””

I see the grub timeout says 10, but there is a “hidden timeout” entry as well.

Pendragon
Pendragon
Reply to  Pendragon
11 years ago

Actually, I might add, if I enter the Boot Menu (I access it by pressing ESC during startup and selecting Boot Menu from a menu) then I can select either xubuntu or Windows 7 from there. Just discovered that this morning. I still want the ability to select a patition on startup though rather than be funneled into xubuntu automatically.

David
David
11 years ago

I got the partitions sorted out and the rest of the install seemed to go without a hitch.

Almost.

Now when I select Ubuntu from the boot menu, I get booted into DOS4GRUB. Now what?

David
David
Reply to  David
11 years ago

Oops, just saw Conrad’s query. Sorry about that.

Conrad
Conrad
11 years ago

I downloaded EasyBCD, went through the simple process. One simple problem. In the version I have, under “Add New ENtry”, when I select Linux/BSD. and then under type choose “GRUB2”, it doesn’t give me any option that says “Ubuntu 12.04 (LST)”. Instead, it only offers me “Neosmart Linus”, which I assume is their house version. I changed the name to Ubuntu, but when I boot into it, it only gives me a DOS line command, it doesn’t boot to Ubuntu. Is there a solution to this, or am I using the wrong software?

David
David
Reply to  finid
11 years ago

I had the same problem and tried that without success. Using GRUB Legacy gets me to a black screen with a flashing flat cursor in the upper left corner.

GRUB Legacy lacks an “auto locate” option. I selected my Linux boot partition one time, and my Linux home partition the next time. Neither worked.

I tried using EasyBCD’s copy of GRUB but I got “unknown device string” errors.

David
David
Reply to  finid
11 years ago

Probably not. Gateway is not on the list of members.

Jim Kyle
Reply to  finid
11 years ago

As of this morning (9/26) I understand there’s a new version of EasyBCD available, that does work with UEFI. I haven’t tested it yet, though.

David
David
Reply to  finid
11 years ago

BTW above results were with EasyBCD v2.2.

whothefuckcares
whothefuckcares
11 years ago

WHYDONT YOU PUT AN INSTALLATION GUIDE WITH ONLY 2 PARTITIONS ??????

David
David
11 years ago

Naturally, my computer screens look different from the ones in this tutorial. So far, my score on that is 100% over 30+ years of operating PCs. I have NEVER been able to follow a tutorial on anything without running into some important difference that brings the whole process to a dead stop.

Anyway, when I get to the list of partitions in the installer (via live desktop from CD-ROM), I have 3 partitions already, not two.

sda1 ntfs size= 13958MB used=12912MB
sda2 ntfs size= 104MB used= 35MB
sda3 ntfs size=986139MB used=45483MB

Assuming I can get around this without reinstalling Windows, how do you recommend allocating a 1TB hard drive?

David
David
Reply to  finid
11 years ago

I don’t know what sda3 is. I was not expecting to see one based on the tutorial.

I do not want to reinstall Windows 7. It should not be necessary.

Can I safely treat sda3 as a partition I can shrink so as to make room for Ubuntu? Will Ubuntu care whether sda3 is its first partition or not?

David
David
Reply to  finid
11 years ago

Windows 7 Disk Management tells me this:

[no name] Recovery partition size=13GB free=13GB

[Gateway (C:)] Boot, Page FIle, Crash dump, Primary Partition size=918.41GB free=876.04GB

[SYSTEM RESERVED] System, Active, Primary Partition size=100MB free=70MB

These appear to match up with sda1, sda3, and sda2, respectively. What worries me a bit is that Windows labels sda2 as “C:”

Arunabha Bhattacharya
Arunabha Bhattacharya
11 years ago

My laptop has C,E and F(each a 100GB) drives on a 320Gb hdd.Now, C and E are primary partitions, with another system reserved space under primary partition. F is a logical drive. Now, what I did was, instead of shrinking my C drive, I shrunk my F drive by 25GB. I partitioned the 25Gb as follows. I then followed the instructions above to have a 400MB /boot partition, 10GB root, 14Gb /home and a bit less than 2GB of swap. Everything installed fine. I rebooted and installed EasyBCD and added the entry. On rebooting now, I’m getting both options. When I’m selecting the Ubuntu entry, its leading to a Grub4Dos command prompt. Please help me out.

Pradyumna
Pradyumna
11 years ago

On being led to your brilliantly instructive tutorial, I installed Ubuntu on my system. Previously, it had 4 partitions – C (Primary p-containing Win XP), D, E, F( all three-logical p; understood by the HD-nomenclature of Linux installer). Now, for the purpose of installing Ubuntu 12.04, I deleted partition E, and re-partitioned it as instructed in the tutorial. All went well, except when I tried to use Easy BCD, the message was:
” The boot configuration data source could not be opened. The system cannot find the file specified.
Would you like to manually load a BCD registry for EasyBCD to manage? Please note that EasyBCD requires the Windows Vista/7 bootloader, and will not work in XP-only environments.”.

So, what are the possible steps I can take to rectify this?

– I can use a pen-drive to boot Linux every time I use it. But, is it possible to do so simply using the Linux USB Stick I created for the installation, and making USB Booting the first priority?

– I had a look at this post (http://ubuntuforums.org/showthread.php?t=1806831), where the following instruction was typed – “It seems that you did not install the GRUB loader on the MBR of the hard drive /dev/sda. The loader was installed on the partition /dev/sda6. I think that this is wrong.

Try to reinstall GRUB ( https://help.ubuntu.com/community/Grub2#ChRoot ). Boot into an Ubuntu Live CD / USB, open a terminal and type these commands:

Code:

sudo mount /dev/sda8 /mnt
sudo mount /dev/sda6 /mnt/boot
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
update-grub
grub-install /dev/sda
grub-install –recheck /dev/sda
exit
for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done
sudo umount /mnt/boot
sudo umount /mnt/usr
sudo umount /mnt
sudo reboot

Is this safe in terms of not interfering with my XP-bootloader? What exactly will I be doing if I follow these steps?

If there’s any non-risky alternative, I would be grateful for your help.

Thank You very much for your time and effort.

Pascual
Pascual
11 years ago

Hello,

Thanks a lot for this guide … but I have one question: I didn’t knew this guide when I installed Ubuntu the first time, so I ended with the default settings, i.e, something like this:

/dev/sda1 Windows System 100MB
/dev/sda2 My C: partition 80GB
/dev/sda3 My D: partition (for media) 300GB

And then it says: 38GB : “Container for Logical Partitions” (/dev/sda4) but in the list (when I do “blkid”) it appears:

/dev/sda5 swap
/dev/sda6 Filesystem (contains data from home and also the remaining system directories).

My problem is the following: I know this is bad and I didn’t anticipate I would be using Ubuntu a lot … and I want to reinstall Ubuntu (I have Ubuntu 12.04) and create the partitions as you say, BUT, I don’t want to reinstall Windows, because I also invested a lot of effor configuring it.

I want:

– To shrink my D partition in order to allow more space for Linux in my new install (I don’t know how to do this, because I I triy to do this from Windows, it would make the systems unbootable for next reboot, because currently my GRUB menu is from Ubuntu)
– Reinstall Ubuntu in the way you recommend without having to reinstall Windows.

I would be grateful if you can help me. Please help!!!!!

Thanks for your attention

Pascual
Pascual
Reply to  finid
11 years ago

Thanks … what I am afraid is the following:

– Lets suppose I enter into the GRUB menu (which is Linux Grub menu, not Windows), I select Windows and shrink D partition inside Windows.

(a) Then, I leave Windows, restart the computer and again … it is Linux GRUB menu that appears. If I select Windows again, everything is expected to work well inside Windows?

(b) If I select Ubuntu in the grub menu … is everything going to work? Or there would be problems inside Linux and then I would need to reinstall Linux right away?

I will be grateful for your answers to questions (a) and (b). The main reason I want to shrink D partition is because I separated very little space for Linux and after installing programs I was left with almost zero space.

I have to say that D partition (NTFS) is used commonly between Windows and Linux, because I store multimedia and Document files. I edited fstab file in /etc so that partition D would be mounted automatically in Linux at startup, so I work with my documents there. So my filesystem partition in Linux only stores programs and all the configuration files, but not Documents.

Thanks for your attention

1 3 4 5 6 7 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