TweakHomePC

Dual-booting all versions of Windows and Linux

   Dual-Boot    |    Win 8    |    Win 7    |    Vista    |    Win XP/2K/NT    |    Win9x/Me    |    How to    |    Legacy 9x Tweaks    |    SiteMap   


 

Here: Home > Dual-Boot > Dual-Boot Windows 7 with other Operating Systems >


Install Dual-Boot of Linux Ubuntu 12.04 (Precise Pangolin) on Windows 7 computer (Win7 installed first and Linux's GRUB2 on Linux partition controlling startup)

Last reviewed: April 2012

October 2013: This is the new location for this page on this site. Please update your link or bookmark.

Introduction

This guide shows how to correctly and safely create a natural dual-boot of Windows 7 and Linux Ubuntu 12.04 (Precise Pangolin) on a computer with Windows 7 already installed. The Linux GRUB2 boot loader will be installed on the Linux partition and put in control of startup (not Windows 7). You can then select either OS from a menu during bootup. Basically you will have a Ubuntu-based computer system that also allows you to boot to Windows 7 whenever you wish. No data loss will occur and a third-party boot utility is not used.

In this procedure you need to create a Primary partition for Linux Ubuntu because that partition must be marked as Active. You will also need a Logical partition for the Linux Swap area. If you already have three Primaries (including a System Reserved) then you should consider overwriting the Windows-created MBR or create a Windows-based system.

If you prefer to overwrite the Windows-created MBR, you should go to this page
If you prefer a Windows-based system, you should go to this page
If you just want a simple method to try Ubuntu for a short period, you should go to this page

All 32 and 64-bit versions of Windows 7 were used in testing. The computers used were:
(1) 64-bit Studio XPS 8100 (2.93 GHz), Core i7, 8 GB RAM DDR3, NVidia GeForce GTX 460, 2x1 TB SATA hard disks.
(2) 64-bit AMD Athlon (2.4GHz), 2.0 GB RAM, 128 MB Radeon XPress, 1 TB SATA hard disk.
(3) 32-bit Dell Optiplex with Pentium 4 (2.26GHz), 2.0 GB RAM, Radeon 7500, 160 GB ATA hard disk

Following these instructions correctly should always succeed. However, any change to your computer should not even be considered unless your have a rescue plan. This guide also contains that rescue plan - just in case!

The procedure used is suitable for experienced computer users.


Important Installation Notes

Shrinking a Windows 8, 7 or Vista drive. You should use Shrink in Windows' Disk Management to resize the Windows partition. You can read Shrink the Windows 8. 7 or Vista Partition for instructions on completing this task successfully. Use the free GParted Live CD to gain disk space only if you must - read the page Use GParted to Resize the Windows 8, 7 or Vista Partition to learn how.

Hidden Active Partition. Many Windows 7 users will have a small Primary disk partition(s) that's marked active and is hidden (but is visible under Disk Management in Windows 7). This must be counted if you want to create a new Primary.


SUMMARY of Procedure (Advanced Users)

  1. Backup.
  2. Create sufficient Unallocated space for Ubuntu 12.04 at end of first hard disk or on a second disk.
  3. Start installing from Ubuntu Live CD
    • In "Allocate drive space", select Something else.
    • Create an EXT4 partition for Ubuntu in Free space (it must be a Primary partition) - use / for Mount Point.
    • Create the Swap partition - use swap area for Mount Point.
    • Optionally, create another EXT4 partition for your data - use /home for Mount Point.
    • In "Device for boot loader installation", select the Ubuntu EXT4 / partition, like /dev/sda3 or /dev/sdb1.
    Install Ubuntu.
    Reboot. Only Windows boots for now.
  4. Bootup from the Ubuntu Live CD and select Try Ubuntu.
    • Run Ubuntu's GParted utility to mark the EXT4 partition as Active.
      Exit and restart computer.

That's it! Linux's GRUB2 boot loader menu will boot either Linux Ubuntu 12.04 or Windows 7 and the original MBR is unchanged. If you ever wish to return to a Windows-controlled startup, just use Disk Management to mark the originally active partition Active again - then, if you wish, you can use the free EasyBCD utility to add Linux to the Windows boot loader menu.

[top of page]

STEP-BY-STEP: Install Linux Ubuntu 12.04 on a Windows 7 computer and create Ubuntu control but leave Windows 7's MBR unaltered

Installing other operating systems on your Windows 7 computer may invalidate your warrantee.

It's important to follow the instructions exactly as stated and you should have a properly working Windows.


Make your preparations

  1. Backup important data before making any changes to a partition. You can burn files to a CD, clone an image of your hard disk, copy files to a USB flash/pen/thumb drive, or use an USB external drive (a good choice)
  2. Download the Ubuntu Desktop 12.04 LTS (Live CD), standard or 64-bit version from www.ubuntu.com.
    Create the Ubuntu installation CD (right-click the downloaded .ISO file & select Burn disc image).
  3. Disconnect all unnecessary external devices before you start.

Make disk space available for Linux Ubuntu

You must create disk space and leave it as Unallocated or Free (not formatted). Decide first on how much disk space you wish to allocate to Linux and if you will create an extra partition (/home) for your Linux data. This data partition can be left intact should you wish to reinstall Linux at a later time. The Swap area size should be about twice your RAM size but you should allow less than twice if you have a lot of RAM.

Make a note of the size of the Unallocated space when it's created.

If installing Ubuntu 12.04 on a 2nd or 3rd hard disk:

  • You should have no trouble using Win7's Shrink in Disk Management to create Unallocated space for Ubuntu.
  • Restart to Windows when finished.
  • Then skip from here to Install Linux Ubuntu 12.04

If installing Ubuntu 12.04 on the first hard disk:

  1. Restart computer correctly (that means close all programs before you Restart computer).
  2. Open Disk Management in Windows 7 (right-click Computer, select Manage, click Disk Management).
    • Right-click the Win7 volume, and click Shrink Volume.
      • In Enter the amount of space to shrink in MB: enter enough for Linux and its Swap file.
      • Click the Shrink button (it may take some time!).
      If Shrink does not give you sufficient Unallocated space, read how to Shrink the Windows 8, 7 or Windows Vista Partition for instructions or use the free GParted Live CD. Then return here.
  3. Restart to Windows two times.

Install Linux Ubuntu 12.04

Raid/LVM was not an issue when testing and partitions were created manually during installation. Ubuntu was installed on previously created Unallocated space with its boot loader installed to the Linux EXT4 / partition. Windows still booted automatically after Ubuntu installation. Finally GParted was used to mark the EXT4 / partition as Active giving control of bootup to Ubuntu which has automatically added Windows to its boot menu.

  1. Bootup from the Linux Ubuntu 12.04 live CD and select Try Ubuntu.
    • When you're ready, select the Install Ubuntu 12.04 LTS desktop icon.
    • In the Welcome window, select the correct language and click Continue.
    • Read the Preparing to install Ubuntu window and click Continue.

  2. In Installation type, select Something else (that's IMPORTANT), and click Continue.
  3. In the new Installation type, do not click 'Install Now' until instructed.
    This section has been designed by the Ubuntu team with dual-booters in mind. Thanks team!

    Highlight the free space you created earlier on the correct hard disk (sda=1st disk, disk0) (sdb=2nd, disk1)
    and click the Add button. Note: the vertical scroll bar appears only when you mouse-over it.
    • The Create partition window will open.
      • In Type for the ..., select Primary (but Logical if 3 Primaries already exist on that disk)
        - if in any doubt, select Logical.
      • In New partition size ..., enter all available minus about 2000 MB for the Swap.
      • In Location for the ..., select Beginning.
      • In Use as:, select Ext4 journaling system (the default) in the drop-down.
      • In Mount point:, select / (forward slash) in the drop-down.
      • Click OK.
    Back in Installation type, highlight the now smaller free space (scroll down if necessary)
    and again click Add.
    • The Create partition window will open again.
      • In Type for the ..., select Logical.
      • In New partition size ..., use all available space (unless creating a data partition).
      • In Location for the ..., select Beginning.
      • In Use as:, select swap area in the drop-down.
      • In Mount point:, no change is allowed.
      • Click OK.

    If you left space for a Linux data partition, now use remaining free space to create, exactly as above, another EXT4 partition for your own data but select /home for Mount Point
     
    The next part is VITAL for the correct location for Ubuntu's boot loader (GRUB2).
    The default is for /dev/sda and you must not accept it.
    • You are still in Installation type.
      Note of the Device name allocated to the Ubuntu EXT4 / partition, like /dev/sda2 ext4 /
    • In the drop-down under Device for boot loader installation:,
      select the /dev/sd** name you just identified for the Ubuntu EXT4 partition.


    Make sure you are happy with what's displayed on-screen.
    When you are ready click 'Install Now', or click Back or Quit.

    Linux Ubuntu 12.04 will now install itself on the new Ubuntu EXT4 partition and will place Ubuntu's boot loader (GRUB2) at the start of that partition.
     
  4. During the installation, you can attend to location, keyboard, password, imports, etc.
    (Log in automatically, under Password, is useful for many home users).

    Click Restart Now when installation is finished, remove the DVD when requested and press the Enter key.
    Window 7 will boot normally.

We now need to make the Linux EXT4 partition Active.


Mark the Linux EXT4 partition as Active


This is the Ubuntu EXT4 partition you created with / as Mount Point.
It must be seen as the first Active partition during bootup.

If you installed Ubuntu on the Windows 7 hard disk

  1. Bootup from the Linux Ubuntu 12.04 live CD and select Try Ubuntu ....
  2. Run GParted (right-click DashHome > Applications > See ... more results > GParted Partition Editor).
    • If you have more than 1 hard disk, click GParted and select the disk containing your EXT4 partition.
    • Right-click the EXT4 partition and select Manage Flags.
    • Tick (to enable) the boot check box
    • Click Close. Exit GParted.
    This also automatically removes the active flag from the original location on the disk.

If you installed Ubuntu on a different hard disk

  1. Use GParted, as above, to uncheck (disable) the Active partition on the Windows 7 hard disk - easiest option.
    =or=
    Change the hard disk boot order in the BIOS so the Ubuntu hard disk is first in the order looked at
    (look in the BIOS for something like Hard Disk Boot Priority).

Restart computer. You will be presented with a Linux Boot Loader menu containing both operating systems.

Congratulations!
You have created a natural dual-boot of Windows 7 and Linux Ubuntu 12.04 (Precise Pangolin) when Windows 7 was installed first, the Linux GRUB2 Boot Loader is now in control, and the original MBR is unchanged.

[top of page]

Remove/Uninstall Linux and reclaim space

Linux Ubuntu is wonderful, regularly updated, and it's free! Nevertheless you may wish to remove it at some stage. Removing Ubuntu and regaining its disk space is quick and painless. Just use Disk Management to make the originally active partition Active again!

  1. Boot to Windows 7
    and open Disk Management (right-click Computer, select Manage, click Disk Management).
  2. To change the location of the Active flag marker.
    • Right-click the partition that was originally marked Active
      • If you have a System Reserved partition then that's it.
      • Otherwise it's probably the partition containing the C:\Windows folders & files.
    • Click Mark Partition as Active and click Yes to the caution.
    If you changed the hard disk boot order in the BIOS, you must change it back to the original order.
  3. Now reclaim hard disk space.
    • Right-click the Swap partition, select Delete Volume..., click Yes.
    • Right-click the Linux partition, select Delete Volume..., click Yes.
    • Right-click the Swap partition, select Delete Partition, click Yes - required for Logical partitions only.
    • Right-click the Linux partition, select Delete Partition, click Yes - required for Logical partitions only.
    • Right-click the partition to the left of Unallocated, select Extend Volume...,
      and click Next to use the maximum space for Windows, and then Finish.
      Alternatively, create a new partition in the Unallocated space and Format it.

In another a few seconds you will have all the Linux space back in Windows 7.

[top of page]

Repair Windows 7 Startup

You will not have any problem if you follow the instructions as stated above. However you might encounter some freak occurrence like a power failure during an installation. Windows 7 will boot again if you execute the following procedure.

  1. Bootup any Windows 7/Vista installation DVD or even from NeoSmart's free Windows 7 System Recovery Disk.
    It must be a 64-bit version if a 64-bit Windows is installed.
    • Press a key when you see Press any key to boot from a CD or DVD.
    • Select your Language and then Time....
    • Select Repair your computer (bottom left of the Install now screen).
      An automatic check of your system will run.
    • Click Repair and restart
      Windows 7 should boot normally (very likely). If not, continue here.
  2. Bootup from the Windows 7 installation DVD again
    • Select Repair your computer again.
    • In System Recovery Options, highlight Windows 7, and click Next.
    • Click Startup Repair.
    • Click Finish when it's complete, and then Restart.
    • You must let CheckDisk run if requested.
      Windows 7 should boot normally.

If still stuck for a solution, boot again from the installation DVD, select Repair your computer, highlight Windows 7, get to a Command Prompt, use DIR command (DIR C: or DIR D: etc.) to identify drive letter allocations (sizes and Labels will help), and type in:
bootrec /FixMbr
bootrec /FixBoot
bootrec /RebuildBcd
X:\boot\bootsect.exe /nt60 C:
  (where X: is your DVD drive letter, and C: is the installation drive for Windows 7).
EXIT, and click Restart. Remove the DVD.

[top of page]

Related Reading

[top of page]

Please remember that you alone are responsible for the consequences of any changes you make to your computer hardware or software.

Copyright © LarryM 1998-2015 thpc@mail.com