- Ubuntu Documentation
- Introduction
- Back Up Your Data
- Have a Windows recovery CD/DVD available
- Getting Recovery Media
- Install Ubuntu after Windows
- Install Ubuntu
- Automatic partition resizing (not recommended)
- Manual partitioning
- Master Boot Record and Boot Manager
- Installing Windows After Ubuntu
- Recovering GRUB after reinstalling Windows
- Master Boot Record backup and replacement
- Also see
- Can’t boot windows after linux install
- Replies (5)
- Can’t boot to windows after installing Ubuntu in UEFI
- 2 Answers 2
- Identifying your situation
- GPT-partitioned system disk — installing a Windows UEFI bootloader
- Install Windows after Ubuntu Linux in Dual Boot Mode
- Step 1: Free up some space from your hard disk for installing Windows after Ubuntu
- Option ‘a’ (Multiple Partitions):
- Option ‘b’ (Single Partition):
- Step 2: Install Windows after Ubuntu on free un-allocated space
- Step 3: Repair Ubuntu Grub Boot Loader
Ubuntu Documentation
Introduction
This page describes how to set up your computer in order to dual boot Ubuntu and Windows. While there are some benefits to dual-booting (e.g. better performance for a native install), it is not recommended. Instead, it is best to do a native install of Ubuntu, and then virtualize the other operating system.
Back Up Your Data
Although this may seem obvious, it is important to back up your files to an external backup medium before attempting a dual-boot installation (or any other hard drive manipulation), in case your hard drive becomes corrupted during the process. External hard drives, USB flash drives, and multiple DVDs or CDs are all useful for this purpose.
Have a Windows recovery CD/DVD available
Some computer manufacturers that pre-install Windows provide a Windows recovery/re-installation CD or DVD with the computer. However, many companies no longer ship a physical disc but instead create a hidden partition on the hard drive in which the recovery-disk information is stored. A utility is then usually provided which allows the user to burn a recovery/re-installation CD or DVD from it. If you are buying a new computer and intend on dual-booting, make sure you have (or can make) a physical Windows recovery/re-installation CD or DVD. If neither a CD/DVD nor a recovery partition/burning utility is provided by your computer manufacturer, you may need to contact your vendor and ask for a CD or DVD (to which you are normally entitled under the Windows EULA).
Getting Recovery Media
You may need to request a physical recovery/re-installation CD or DVD directly from your computer manufacturer. See WindowsRecoveryCd.
Once you have created a physical backup disc from a restore-image partition on the hard-drive, the restore-image partition can either be removed or left in place. Ubuntu can be installed with it intact without problems.
Install Ubuntu after Windows
A Windows OS should be installed first, because its bootloader is very particular and the installer tends to overwrite the entire hard drive, wiping out any data stored on it. If Windows isn’t already installed, install it first. If you are able to partition the drive prior to installing Windows, leave space for Ubuntu during the initial partitioning process. Then you won’t have to resize your NTFS partition to make room for Ubuntu later, saving a bit of time.
When a Windows installation already occupies the entire hard drive, its partition needs to be shrunk, creating free space for the Ubuntu partition. You can do this during the Ubuntu installation procedure, or you can see How to Resize Windows Partitions for other options.
If you have resized a Windows 7 or Vista partition and cannot boot up Windows, you can use the instructions from WindowsRecovery to fix it.
Install Ubuntu
Download an Ubuntu LiveCD image (.iso) from Ubuntu Downloads and burn it to a disc (see BurningIsoHowto).
Automatic partition resizing (not recommended)
- Choose the first option, which should say «Install them side by side, choosing between them each startup».
- Specify the size of the new partition by dragging the slider at the bottom of the window.
- Click on «Forward».
Manual partitioning
- Choose «Manually edit partition table».
- Listed will be your current partitions.
- Select the partition you want to resize and press Enter.
- Select «Size:», press Enter.
- Select Yes, press Enter.
- Type in a new size in gigabytes for your partition, it’s recommended you free up at least 10 GB of free space for your Ubuntu install. Press Enter when happy with your changes. It may take some time to apply the changes.
Create a swap partition of at least your amount of RAM (if you don’t know, 8000 MB is a good value).
Create a partition for your Ubuntu installation.
Create other partitions if necessary: see DiskSpace
Master Boot Record and Boot Manager
GRUB2 is the boot manager installed in Ubuntu by default. GRUB2 is an open source boot manager that install the main parts of the boot loaders inside Ubuntu. This means Ubuntu is independent and avoids any need for writing to other operating systems. To accomplish this, the only thing in your computer outside of Ubuntu that needs to be changed is a small code in the MBR (Master Boot Record) of the first hard disk, or the EFI partition. The boot code is changed to point to the boot loader in Ubuntu. You will be presented with a list of operating systems and you can choose one to boot. If you do nothing the first option will boot after a ten second countdown. If you select Windows then GRUB or LILO will chain-load Windows for you at the Windows boot sector, which is the first sector of the Windows partition.
Windows Vista no longer utilizes boot.ini, ntdetect.com, and ntldr when booting. Instead, Vista stores all data for its new boot manager in a boot folder. Windows Vista ships with an command line utility called bcdedit.exe, which requires administrator credentials to use. You may want to read http://go.microsoft.com/fwlink/?LinkId=112156 about it.
Using a command line utility always has its learning curve, so a more productive and better job can be done with a free utility called EasyBCD, developed and mastered during the times of Vista Beta. EasyBCD is very user friendly and many Vista users highly recommend it.
Installing Windows After Ubuntu
There are two different approaches:
Recovering GRUB after reinstalling Windows
Please refer to the Reinstalling GRUB2 guide.
Master Boot Record backup and replacement
This method does not work for computers with UEFI boot. In consequence, it won’t work for pre-installed Windows 8 and some pre-installed with Windows 7.
Back-up the existing MBR, install Windows, replace your backup overwriting the Windows boot code:
- Create an NTFS partition for Windows (using fdisk, GParted or whatever tool you are familiar with)
Backup the MBR e.g. dd if=/dev/sda of=/mbr.bin bs=446 count=1
Install Windows
Boot into a LiveCD
Mount your root partition in the LiveCD
Restore the MBR e.g. dd if=/media/sda/mbr.bin of=/dev/sda bs=446 count=1
Also see
MultiOSBoot — How to boot more than two operating systems from a single hard drive.
WindowsDualBoot (последним исправлял пользователь tobefree 2015-06-29 08:09:22)
The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details
Can’t boot windows after linux install
Replies (5)
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
1 person found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
How satisfied are you with this reply?
Thanks for your feedback.
From your booted Linux system, use the following command in a terminal:
This should detect Windows 8.1 and add it or fix it.
If nothing happens, boot from the Windows 8.1 CD and go to recovery console:
As you are in the recovery mode, use Windows 8.1 fix boot errors tool. (Forgot the exact name of the tool) and reboot.
Now you would have Windows but not Linux.
Try reinstalling Linux — put MBR partition into sda (as opposed to sdb like before) or try sudo update-grub from the live CD.
3 people found this reply helpful
Was this reply helpful?
Sorry this didn’t help.
Great! Thanks for your feedback.
How satisfied are you with this reply?
Thanks for your feedback, it helps us improve the site.
Can’t boot to windows after installing Ubuntu in UEFI
I’m trying to install an Ubuntu dual boot on my windows 10 laptop. Windows 10 used the legacy BIOS setting.
When I start the Ubuntu installation I get a warning about BIOS and UEFI, other operating systems becoming unbootable, only proceed if sure, etc. But since no alternative is offered (other than simply giving up and not installing Linux) I decided to proceed, and found that after install, GRUB only offered a Linux option.
Is there a way for me to boot from Windows again? I don’t mind to uninstall ubuntu
2 Answers 2
Depending on exactly what the warnings said, and what exact choices you made when installing Ubuntu, the installation process may have done one of a few things:
It may have converted the partitioning from MBR to GPT style to install UEFI-style, keeping (or resizing) the existing partitions. This is the best option: you’ll just need to install a UEFI-style bootloader and you can then get back to Windows. Once the Windows UEFI bootloader is on the disk, Ubuntu might even detect it automatically the next time you run sudo update-grub and add it to the GRUB boot menu for you.
It may have just set up a UEFI-style bootloader on a MBR-partitioned disk. This is a problem, since while Linux can do this, Microsoft says Windows won’t support this combination. However, returning to legacy-style Windows-only boot should be fairly easily doable in this case.
It may have taken the entire disk for Ubuntu, so your Windows installation was overwritten and no longer exists. This is the worst-case scenario: if you want Windows back, you’ll need to fully reinstall it and your existing Windows files will be gone.
Identifying your situation
In Linux, run sudo fdisk -l /dev/sda . If your system disk is something other than /dev/sda , replace that with the appropriate device name. For example, on a new system with a NVMe SSD, it might be /dev/nvme0n1 instead.
The output should look similar to this:
If your version of Linux fdisk isn’t too old, the output should include a line that says either
This identifies the partitioning style that is currently in use on your system disk.
GPT-partitioned system disk — installing a Windows UEFI bootloader
Since the Linux installer has set up a UEFI bootloader for us, there should also be an EFI system partition (ESP for short) on the disk. In the fdisk -l output, it is the partition that has its Type listed as EFI System and its size would typically be something in between 100M and 512M. In Linux, it might be mounted at /boot/efi . You might want to run sudo ls -l /boot/efi or take a peek at it with some GUI file manager so that you’ll recognize the contents of this partition — you’ll be seeing it at Windows command prompt for a bit. Typically, if ESP is mounted at /boot/efi , there should be a sub-directory like /boot/efi/EFI/ubuntu that contains the actual UEFI bootloader of Ubuntu.
Now, get yourself a Windows 10 installation media. You won’t need the license code. Boot your computer from that installation media. Since your Ubuntu installed in UEFI mode, your computer will probably boot the Windows installer in UEFI mode automatically too, but in case you see two boot options for the installation media, only one of those options boots it in UEFI mode, and that’s the one you should pick. (Hopefully the boot menu will say which is which — it depends on your system’s UEFI firmware.)
When the Windows installer displays the initial screen with an «Install now» button in the middle of the screen, select instead «Repair your computer» near the bottom.
From the next menu, choose «Troubleshoot» and then «Command Prompt».
Now, type in these commands:
This should display a list of partitions. Find the partition that has FAT32 in the «Fs» column — it should be your ESP you saw in Linux before. Note its volume number ( Volume ### in the leftmost column) and assign an unused drive letter (like X:) for it. For example, if ESP is listed as Volume 2 :
It should say DiskPart successfully assigned the drive letter or mount point. at this time. Then type exit to quit the DiskPart utility.
Switch to the EFI directory on the ESP:
If you see the ubuntu directory, you’re in the right place.
Now create a directory or two for the Windows UEFI bootloader:
Install the Windows UEFI bootloader to the ESP and re-create the Windows BCD registry:
If you want the Windows bootloader to use a language other than English, replace en-us in the command above with the appropriate Windows language code.
Now type exit , remove the Windows installation media and reboot your system. It should come up in Ubuntu just as before. Run sudo update-grub to update the GRUB boot menu. If all goes well, it should now auto-detect the presence of UEFI Windows bootloader and add it to the GRUB boot menu.
Also now in the BIOS boot order menu, there should be a item named «Windows Boot Manager». If you want to remove Ubuntu and go back to Windows-only system, just switch this one as the primary boot option, and the system should skip GRUB and boot into Windows by default. Then you can remove the Linux partitions using Windows Disk Management. Do not remove the EFI System partition, as now Windows also needs it for booting.
(Work in progress — I’ll add the MBR restoration option later)
Install Windows after Ubuntu Linux in Dual Boot Mode
In this article we are taking Ubuntu flavor of Linux Operating System. Each of these Operating Systems will act as a Host Machine. The system can load one of the operating system at a time. That means you can either load Windows or Ubuntu Linux at a time. We will install each of the operating system on a different disk partition. Generally, a user installs Windows first and then installs Ubuntu Linux after Windows. On successful installation, the user gets an option to choose one of the dual boot operating systems. User may choose either Windows or Linux from the boot menu to load the operating system. The user can also switch between Linux and Windows as per his requirement. He can restart the operating system he is using, select another operating system from boot menu and load it.
Normally, when a user installs Ubuntu Linux over Windows, things go fine. Whereas, if the user installs Windows over existing Ubuntu Linux, there are two problems:
The Ubuntu Linux is lost ! The boot loader menu is also lost !
The system is only left with Windows without any trace of Ubuntu. So, what to do if you want to install Windows over existing Ubuntu Linux? Or is it that we have to always go the other way around only? The answer is No. You can go either way. That means, either you can install Ubuntu first or you may install Windows first.
But what goes wrong when we install Ubuntu first and then Windows? The answer is that Windows Boot Loader overwrites the Linux boot loader. Since, the option to load Linux is lost in absence of Linux boot loader. Thus, the user is not able to load Ubuntu. So, we need to perform an extra step. The step is to repair Linux (GRUB) boot loader after installing Windows over Ubuntu Linux.
Let us see how to install Windows over Ubuntu in dual boot mode using boot repair in following simple steps:
Note : Ensure that you have backup your data saved on your system with existing Ubuntu Linux as it may be lost in case some error occurs during installation process.
Step 1: Free up some space from your hard disk for installing Windows after Ubuntu
It is possible that you may have single or multiple partitions on your computer. If you have a single partition then follow option ‘b’ below. Else, if you have multiple partitions then follow option ‘a’ below:
Option ‘a’ (Multiple Partitions):
If you have multiple partitions, let’s say you have two partitions. Then Partition 1 will contain Ubuntu Operating System and Partition 2 may contain some other user data. You can see the same in image below as an illustration:
You can shrink the partition containing data to free up space for Windows. But you cannot resize the partition containing Ubuntu system files. To resize second partition, open “Disks” application from Ubuntu application menu as shown in below image:
Follow below mentioned steps to resize the partition on which Ubuntu is not installed:
A. Select Partition 2
B. Unmount partition 2
C. Click settings icon
D. Select Resize option
E. Drag resize slider to free up appropriate space
F. Click ‘Resize’ button
The above steps are shown in below image as an illustration:
As a result of above steps, free space will appear after Partition 2 as shown below in green box:
Close the ‘Disks’ application on successful resizing and un-allocation of disk space for Windows OS.
Option ‘b’ (Single Partition):
The method mentioned above will not work if your system has single partition. In case of single partition, the Ubuntu system files will exist on this single partition. While you are operating Ubuntu, the system files will be in use. Thus, the Disk volume will be busy. A busy disk volume cannot be unmounted. The system cannot resize a mounted or busy disk.
Thus, we need some external factor to boot from and resize the single partition on which Ubuntu Operating System exists. For the purpose, we will boot the computer from bootable Ubuntu Flash Drive and use ‘GParted’ utility.
If required, check out one of the following ways on how to create a bootable Ubuntu Flash Drive:
Boot from Ubuntu Flash Drive:
Once you are ready with bootable Ubuntu Flash Drive, insert it in the computer and restart the system. While the system is rebooting press F10 (or Del or F9 or F12 or Esc) to enter BIOS Setup. You may try other keys as per Make and Model of your machine to enter BIOS setup. Select USB Storage Boot as Booting Device from boot options. Save and Exit. The system will reboot again. While the system is rebooting press F9 (or Del or F10 or F12 or Esc) to display Boot Menu. You may try other keys as per Make and Model of your machine to display boot menu.
Select Flash Drive as Boot Device from the Boot Menu List and Hit Enter. Ubuntu setup will load from the Flash Drive. Click on ‘Try Ubuntu’ option from Ubuntu setup as shown in below image as an illustration:
Live Session of Ubuntu Linux will load from Flash Drive.
Run GParted application:
Open ‘GParted’ application in this live session from application menu. The GParted icon will be as shown in below image:
GParted will detect and display the Hard Disk with its capacity and the existing partition on it. Click on the partition to select it. Then, click on the ‘resize’ button as shown in below image:
Click on the ‘Resize’ button. A dialog box will open with options for resizing partition. You can resize the partition by entering either free space size or New size of partition in Megabytes. Alternatively, you may also use the slider to change the size of the partition as shown in below image:
Drag the slider to shrink the partition and free space as un-allocated space as per your requirement. Satisfy yourself with new size of partition and new un-allocated space freed from the partition. Then click on ‘Resize/ Move’ button as shown in below image:
The un-allocated space will be shown in grey color. We will use this un-allocated space to install Windows 10 on it. Click on ‘Apply’ button to save the resizing changes. The un-allocated space and ‘Apply’ button are highlighted in below image:
Click on ‘Apply’ to save the changes in the popped-up dialog box to save the resized configuration of the partition. Wait till all resizing operations are successfully completed. Then close the Gparted Application. Reboot the system. Remove Ubuntu Flash Drive from the Computer when Ubuntu live session prompts for it before system reboot.
Reboot computer to check disk changes:
The system will then boot from computer hard disk and load existing Ubuntu Linux system. You may login to Ubuntu system and check disk partitions. The above must have shrink the Linux partition. Also, it must have create an un-allocated space. The same is shown in below image in green box as an illustration:
The First step should be successful by now. You will be ready with an un-allocated space on your hard disk. We will use this space to install Windows 10 on it as a dual boot host system.
Step 2: Install Windows after Ubuntu on free un-allocated space
Boot from Windows Flash Drive:
Insert Windows bootable Flash Drive. Restart the system. Boot the system from Windows Flash Drive. Press F9 (or Del or F10 or F12 or Esc) to display Boot Menu. Select Flash Drive as Boot Device from the Boot Menu list and Hit Enter.
Windows 10 installation setup will Load from Flash Drive. On the Windows installer welcome screen select basic information such as Language, Time, Currency Format and Keyboard or Input Method. If you do not have any particular choice, proceed with default values and click on ‘next’ to continue.
Click on ‘Install Now’ button to begin installation process. The installation process will prompt to Activate the copy of Windows operating system.
It may be noted that Windows is not a Free Operating System. You will need to purchase a License to use it. The license can be purchased and activated later with Product Key provided during purchase. As of now, click on ‘I don’t have a product key’ to continue windows installation.
Select the Edition of Windows you wish to use, ‘Windows 10 Pro’ is best suited for professionals. Accept the License terms and click on ‘Next’ to continue. Accept the Windows license by clicking the check box with label ‘I accept the license terms’. Then click on ‘next’ to continue.
Windows installer will inquire you about the type of installation you want? Since this will be a fresh installation, select ‘Custom Installation’ instead of ‘Upgrade’ from the installation type options.
Now, the most crucial step. Windows installer will ask you, where to install Windows?
Select Partition to install Windows:
As you can see in below image, the first partition i.e. Partition 1 on Drive 0 is primary partition with Ubuntu installed on it. Also, an un-allocated space (of 500 GB in this example) is available for use.
Select the un-allocated space and click ‘New’ to create a New Partition from this un-allocated Space for Windows installation. When prompted, click on ‘Apply’ and then ‘OK’ to create a new partition. Windows setup will create a system partition (approximately
500 MB) and a user partition (Balance Space). The same is shown in below image:
Select the newly created Partition other than system partition and click on ‘Next’ to proceed for installation. The installation process will start. Wait till Windows setup files are copied and copied setup files gets ready for installation. The installer will install Windows features from setup files. If your system is connected to internet Windows may install Updates as well. Wait till installation process is complete.
Note: The Computer may automatically restart few times during the installation process. Keep the Flash Drive inserted in the computer. Do not press any key during system restart. Doing so may boot the system from Flash Drive again and fresh installation will start.
Configure Windows after installation:
After installation, the setup will continue to start services and ready the devices. The system may restart multiple times during configuration. When setup prompts, select your region, select the keyboard layout and add secondary keyboard layout. Else proceed with default options if there is no particular requirement. You may setup Windows for personal use and may add organizational details at a later stage, if required. If you have a Microsoft account ID you can provide it. Else proceed with offline account and create online account later. You may select one of the Microsoft group’s account for login. Else, click ‘No’ if no Microsoft Group’s account is available, you can add such accounts later.
Type your Name and click ‘Next’ to continue. Create a strong password followed by secret questions. Click on ‘Accept’ to designate Cortana as your Digital Assistant while you use Windows Operating System. Choose Privacy settings, else proceed with default options, if no particular choice.
Your Windows 10 Operating System will be ready for Use. Open File explorer to check disk partition. You will see C: Partition with available capacity. Also, open Disk Management in Computer Management to check Disk Partitions. All disk partitions will be visible here. But Linux system partition will not be visible in Windows File Explorer. Close Computer Management. Restart Windows. You will notice that Windows OS has loaded without showing any option to switch between Ubuntu and Windows. This happens because Windows Boot Loader overwrites existing Linux Boot Loader. Let’s follow step 3 to repair the GRUB boot loader and restore Ubuntu operating system.
Step 3: Repair Ubuntu Grub Boot Loader
Re-insert Ubuntu Flash Drive and restart windows. Boot from Ubuntu Flash Drive by selecting option from boot menu. Press F9 (or Del or F10 or F12 or Esc) to display Boot Menu. You may try other keys as well as per make and model of your computer. Ubuntu setup will load from flash drive. Click ‘Try Ubuntu’. Ubuntu Live Session will load from Flash Drive. Open Terminal in Live session of Ubuntu.
Add repository of ‘Boot-Repair’ application and update package database by typing the following commands in terminal:
sudo add-apt-repository ppa:yannubuntu/boot-repair
After updating the package database, type following command to install ‘Boot-Repair’ application:
Enter root password and press ‘Y’ or ‘Enter’ key when prompted. After installing ‘Boot-Repair’ application, run ‘Boot-Repair’ application by typing following command:
The boot repair application will open from terminal prompt. Click on ‘Recommended repair’ button as shown in below image:
Wait for the boot repairing process to complete. You may click on ‘No’ when prompted to upload the boot-info to paste bin. If there is some error during the process. You may click ‘yes’ to save and share the error messages occurred during the process. Boot Repair application will display Boot Info Summary after successful repairing of GRUB boot loader. Close the summary report and exit Boot-Repair application.
Reboot your computer:
Remove Ubuntu Flash Drive from the computer when prompted and hit ‘Enter’. Wait for the system to restart. Upon restart, the system will display the Boot Loader to choose between Ubuntu and Windows operating system. The same is shown in below image as an illustration:
As shown in above image, first option is for loading Ubuntu whereas last two options are for Windows. Select first option and hit ‘Enter’ to load Ubuntu Operating System. Existing Ubuntu Operating System will successfully load from the hard disk. Reboot the system. The GRUB boot loader will load again. Select one of the options as shown in image above to load Windows operating system.
Watch the practical demonstration of the above the above process in below video:
Note: The above video also shows how to share files between your Windows and Ubuntu system existing in dual boot mode on a computer.
We hope the above information was useful for you. Alas! Information keeps on updating. Follow us on social media, subscribe to our blog or subscribe our YouTube Channel to receive latest updates.