Install windows after install linux

I have Ubuntu on my laptop. Now I want install Windows 7 in a dual-boot. How can I do this?

I can’t lose my Ubuntu files, and I’m afraid that I might break GRUB.


Editor’s note: Current readers should keep in mind that this is an older question, and the exact steps may have changed over time. Also, UEFI has primarily replaced BIOS in that time. As a result, many answers here may be out of date. Make sure you choose an answer appropriate to UEFI or BIOS depending on your system, and consider favoring more recent answers which may have more up-to-date information.

NotTheDr01ds's user avatar

NotTheDr01ds

15.8k6 gold badges52 silver badges80 bronze badges

asked Oct 12, 2010 at 7:28

Sk8er's user avatar

5

Here’s the general outline:

  1. Make space for Windows
  2. Install Windows
  3. Mount the /boot directory or partition
  4. Install the bootloader (GRUB)

Step Zero – Backup your important data before doing anything

Step One – Make space for Windows

Open up GParted, and make sure that you have at least 20 GB available for Windows 7, either as a partition you can remove, or as unpartitioned space. If it’s a partition, remove it from GRUB to make sure it doesn’t break your Ubuntu install — GParted will complain if anything bad is about to happen.

Make note of current /boot device. If that doesn’t show up there, make note of the / device. The device name is something like sda5.

Step Two – Install Windows

Install Windows 7 into the space you just made

Step Three – Mount /boot

Note: Instead of mounting the boot directory or partition from the installation in the live media environment you can specify the path with the --boot-directory parameter for grub-install, more information on the manpage.

Load up from your Ubuntu live CD, and then run these commands.

  • If you DO NOT have a separate /boot partition:

    sudo mount /dev/DEVICENAME_FROM_STEP_ONE /mnt
    sudo rm -rf /boot    # Careful here, make sure YOU ARE USING THE LIVE CD. I tried it, it works.
    sudo ln -s /mnt/boot /boot
    
  • If you have a SEPARATE /boot partition:

    sudo mount /dev/DEVICENAME_FROM_STEP_ONE /boot
    

Step Four – Install the bootloader

Note: These instructions were initially written for Windows 7 and BIOS booting computers. If you have UEFI and Windows 8 and above you probably need to replace grub-pc with grub-efi-amd64 in sudo apt-get install grub-pc.

Then continue with those commands:

sudo apt-get update
sudo apt-get install grub-pc
sudo grub-install /dev/sda     # NOTE THAT THERE IS NO DIGIT
sudo umount /boot

And restart. It should work fine and boot both systems.

Scott Stensland's user avatar

answered Oct 12, 2010 at 7:42

evgeny's user avatar

evgenyevgeny

9,4753 gold badges27 silver badges28 bronze badges

14

Installing Windows after Ubuntu is not the recommended process for a dual boot Windows and Ubuntu system, but it is possible.

  • First, you have to make sure that the 50GB free space is available, resizing your Ubuntu by using gParted if necessary.

  • Also use gParted or Disk Utility to format the free space as NTFS, this prevents Windows 7 from creating an additional boot partition in addition to the «C» drive.

  • Next, boot to the Windows DVD installer and install Windows on the NTFS partition. Upon reboot, Windows will automatically boot and you won’t see the grub menu allowing you to choose Ubuntu, because the Windows bootloader has replaced grub.

  • Now, what you need to do is run Ubuntu from LiveCD or LiveUSB and install boot-repair.

  • To install boot-repair, open up a terminal by pressing Ctrl+Alt+T and type the following commands:

      sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
      sudo apt-get install -y boot-repair && boot-repair
    
  • After installation, boot-repair will automatically launch, if is doesn’t, launch it via Dash.

  • Make sure to select recommended repair to repair grub. Reboot and that’s it.

  • You should now have a Grub menu on boot, allowing you to choose from Ubuntu, memtest, and Windows 7.

Anton Samokat's user avatar

answered Jul 1, 2012 at 14:13

Peachy's user avatar

PeachyPeachy

7,07710 gold badges37 silver badges46 bronze badges

10

UEFI only!

This answer covers UEFI-only, and is meant to be a bit of a more modern answer as UEFI has succeeded the ancient BIOS. Also, there are some edits here to fit the fact it’s answering a «how I do this» rather than a «can I do this» type of question.


To install Windows alongside Ubuntu, you just do the following:

  1. Insert Windows 10 USB
  2. Create a partition/volume on the drive to install Windows 10 on alongside Ubuntu (it’ll create more than one partition, that’s normal; also make sure you have space for Windows 10 on your drive, you might need to shrink Ubuntu)
  3. Install the Windows 10.

That’s it!

Note: when making sure things are ready for your dual boot, check if Ubuntu is installed in the GPT partition table! While 99% of the time you will be using GPT if you’re planning to do this, it is possible to install Ubuntu’s UEFI on MBR but Windows 10 does not support that strange use-case. In that situation, convert to GPT if possible. If not, backup and reinstall, and I’d recommend that as it’ll be easier.

Community's user avatar

answered Feb 21, 2019 at 9:33

RoundDuckMan's user avatar

6

boot-repair did a really good job launched from a live-usb, by just applying the recommended option.

Gazler's user avatar

answered Mar 17, 2012 at 6:01

Quesst's user avatar

QuesstQuesst

1391 silver badge2 bronze badges

1

When you boot have you checked the boot order on your BIOS? If you’re booting straight to the hard drive it will always miss the USB. You need to move the USB device boot option higher in the priority list.

Also check that your computer allows you to boot from USB in the USB port you are using.

answered Dec 24, 2012 at 13:49

Slipstream's user avatar

SlipstreamSlipstream

1,1691 gold badge11 silver badges26 bronze badges

2

First, you have to boot with a live CD/USB stick and shrink your partition in order to create a second one. Windows 7 requires and creates a second partition which is called «system reserved». I don’t know why, but it does. (So you will end up with three partitions or four if you have a swap partition.)

When your partition is ready, just boot with your Windows 7 DVD/USB stick and install Windows 7 on the new partition.

When Windows 7 has been installed, GRUB will break and you will only be able to boot Windows (automatically). Just boot with a live Ubuntu CD/USB stick and fix it (how it is mentioned in other comments).

Now another issue that some users may face:

I own an HP Mini 210 netbook which came with Windows 7. I erased everything and installed Ubuntu. Later on I decided to also reinstall Windows 7 and have a dual boot (needed Windows for a specific application from my university which wouldn’t run through wine). At that time I had three partitions:

- Ubuntu
- Swap
- Backup/download storage

Now when I tried to install Windows 7 I faced a problem because Windows 7 needs to create a second primary partition (system reserved). I already had three partitions and therefore was unable to create two more. The workaround here is to create an extended partition in which you will include both swap and backup storage. Now I have:

- Ubuntu (primary)
- Extended
  - Swap
  - Backup/download storage
- Windows 7 (primary)
- Windows 7 system reserved (primary)

Peter Mortensen's user avatar

answered Oct 12, 2010 at 8:23

Antonis's user avatar

AntonisAntonis

7103 silver badges6 bronze badges

One good advice: When you make the separate partition for Windows 7, using gparted for example, format it to the NTFS right away. Do not use Windows installer to format the partition, because several times I had a situation, when the Windows installer corrupted the partition table after that and I had to restore the lost partition.
So, as the people recommended here: using gparted, create separate partition, format it to the ntfs, install windows there, then restore grub using livecd or liveflash. You can use the SystemResqueCD for liveflash.

answered Oct 12, 2010 at 8:51

Yuriy Tkach's user avatar

To install Windows you need an empty partition that will be dedicated to Windows. If you do, then go ahead and install on this using the normal installation procedure. After installation, reboot into Windows and reboot a few times more to experience Windows ;-) (sorry, couldn’t resist)

Like you said, this will break GRUB and your computer can only boot Windows after this. Do not despair, as there is a help section dedicated to restoring GRUB and being able to dual boot. Look here. After performing this, your computer will be able to boot Ubuntu as well as Windows.

Before you start, very very carefully note down the location (hard drive number, make & partition number within that) of the current Ubuntu install (which you don’t obviously want to overwrite) and the empty partition in which you want to install windows. Also, during Windows installation, if it offers to format any partition other than the one you are installing Windows into, please do not accept.

Peter Mortensen's user avatar

answered Oct 12, 2010 at 7:38

koushik's user avatar

koushikkoushik

5,0024 gold badges27 silver badges35 bronze badges

0

Basically the same answer as @evgeny, but using chroot instead of a symbolic link.

  1. Boot into a Ubuntu LiveCD
  2. Open GParted and make sure you have an unused partition with at least 20GB free space. This will be your Windows 7 partition.
  3. Install Windows 7 onto this partition.
  4. Boot into a Ubuntu LiveCD
  5. Make a note of the partition Ubuntu is installed on and any separate /boot partitions if applicable.
  6. Mount your Ubuntu installation

    sudo mkdir /mnt
    sudo mount /dev/<partition> /mnt
  7. Give this partition internet access

    sudo cp /etc/resolv.conf /mnt/etc/resolv.conf
    
  8. Only if you have a seperate /boot partition, otherwise skip this step

    sudo mkdir /mnt/boot
    sudo mount /dev/<boot_partition> /mnt/boot
  9. Set up then enter chroot

    sudo mount -o bind /proc /mnt/proc
    sudo mount -o bind /dev /mnt/dev
    sudo mount -o bind /dev/pts /mnt/dev/pts
    sudo mount -o bind /sys /mnt/sys
    sudo chroot /mnt
    
  10. Make sure grub-pc is the latest version

    apt-get update && apt-get install grub-pc
    
  11. Install GRUB

    grub-install /dev/sda
    
  12. Exit chroot

    exit
    
  13. Reboot and check if it works

answered Oct 4, 2013 at 21:27

kiri's user avatar

kirikiri

27.8k16 gold badges81 silver badges117 bronze badges

In case your computer came with a pre-installed copy of Windows 8 and you removed it because to many people told you to hate it and you found that after you installed Ubuntu, that it isn’t what you want, note this:

Your computer boots with UEFI and has a GPT partition table.

For installing Windows 7, either create and boot the Windows 7 installation media in UEFI-mode or set boot-mode and partition table to legacy.

answered Aug 9, 2014 at 18:49

LiveWireBT's user avatar

LiveWireBTLiveWireBT

28.5k26 gold badges108 silver badges221 bronze badges

2

The most save way is to install Windows 7 first and to reinstall Ubuntu after that. This will ensure that grub works.

You can also edit your partitions with a live cd, and then install Windows 7. When you have done this you boot into Ubuntu with a live cd and restore grub. This procedure however, is a bit more delicate than just installing them in the right order.

answered Oct 12, 2010 at 7:37

Peter Smit's user avatar

Peter SmitPeter Smit

7,4679 gold badges42 silver badges48 bronze badges

I suggest you virtualize Windows 7 with something like VirtualBox (http://www.virtualbox.org)

This way you can run Windows and Linux at the same time, without the chance of destroying you Bootloader Grub.

I don’t know why you want to run Windows 7, but if you don’t need the full hardware capacity (Running the Latest 3D Games for example) of your computer for windows then virtualization can be a good solution.

answered Oct 12, 2010 at 8:26

Niels van Reijmersdal's user avatar

2

Its a easy process to install dual OS. 1st create a NTFS partition from Ubuntu using Disk Utility. Then restart your system and continue with your windows installing. After finishing installing you can see that your GRUB is not working….. NOT A PROBLEM. I have two method to fix this GRUB problem.

[Method 1] Try to reinstall GRUB under Ubuntu LiveCD. For example, like recommended @kiri above in this answer.

[Method 2] It may be bit difficult. Don’t worry i have also a easy one. For that you have to login into windows. Download EasyBCD and run it. Go to Edit Boot Menu and set your desired boot option as default. Then save it and reboot your system. [Tested under windows].

Please let me know if you stack in something.

Anton Samokat's user avatar

answered Jul 1, 2012 at 12:36

ScareCrow's user avatar

ScareCrowScareCrow

1341 silver badge13 bronze badges

0

Boot that USB

  1. Turn on or restart the computer.
  2. While the display is blank, press the F10 key to enter the BIOS settings menu.

    NOTE: The BIOS settings menu is accessible by pressing the F2 or the F6 key on some computers.
  3. Select the Advanced tab using the right and left arrow keys.
  4. Press Enter.
  5. Use the up and down arrow keys to select Boot Order.
  6. Follow the on-screen instructions to change the boot order so that USB is at the top
  7. Press Esc.
  8. Select the Exit tab using the right and left arrow keys.
  9. Press Enter.
  10. Press Enter.

Reboot…

answered Dec 24, 2012 at 15:45

2

Installing windows after ubuntu is a pain but after you do this you’ll need to put in your ubuntu live cd and install boot-repair and run that. Becouse installing win7 after ubuntu will break grub. But, boot-repair will remedy that!

answered Jul 1, 2012 at 13:20

jamie's user avatar

jamiejamie

234 bronze badges

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

When it comes to dual boot, the general idea is that you have a system preinstalled with Windows and then you install Linux alongside Windows. On the boot, you select whether you want to use Windows or Linux.

How about the opposite situation? What if you have a system that has only Linux installed on it and you want to install Windows alongside Linux in dual boot mode?

In this tutorial, I’ll show you exactly how you can install Windows after Ubuntu Linux in dual boot.

Dual booting Windows on an existing Ubuntu Linux system

install windows after ubuntu

I tested this tutorial on an Ubuntu system with UEFI and GPT partitioning scheme. In theory, the same steps should be applicable to most Linux distributions, if not all.

Requirements

Here’s all the stuff you need to carry out the procedure safely and easily:

  • A bootable Windows 10 USB stick (USB key, Pen Drive) of at least 8 GB in size
  • A live Ubuntu USB stick (USB key, Pen Drive) of at least 4 GB in size
  • A computer with UEFI boot and only Ubuntu Linux installed on it
  • Internet connection is needed for creating the bootable Windows and live Linux disk
  • A way to back up your important data on an external disk (optional yet recommended)

You may also manage this tutorial with just one USB key. You create the live Linux USB first, make the partition for Windows using this live Linux USB, and then use the same USB key as a bootable Windows USB.

I highly recommend that you read the entire tutorial first before you start following the steps.

Step 0: Make a backup of important data

Here’s the thing. You are going to play with disk partitions and boot settings. If you mess it up, you’ll lose the data.

Having a back up on an external disk will give you a safety net. In the worst case, if things go wrong, you can install either of Windows or Linux and copy the data back on your system.

How do you make a backup? The simplest method is to have an external USB or SSD disk and copy files from Documents, Music, Pictures and other folders where you have kept your files.

Step 1: Create a bootable Windows USB

If you have access to a Windows system, you can follow the instructions on the Microsoft website to create a bootable Windows media.

If you only have a Linux system, creating a bootable Windows USB could be tricky. Thankfully, a handy open source tool called Ventoy helps a lot in this case.

I have written in detailed about creating bootable Windows 10 USB on Linux. Please refer to the guide for detailed instructions. I’ll mention the crucial parts here.

Plug in your USB with at least 8 GB of size and format it. Now, download the ISO of Microsoft Windows.

Next, download the latest Ventoy release. Extract the folder and run the VentoyWeb.sh script with sudo. It will give you the URL when you run it. Copy this URL and paste it in a browser.

run ventoy linux

It will open a web page with Ventoy running in it. Go for UEFI installation and hit the install button.

choose partitioning scheme

Once installed, you’ll see two partitions on the USB disk: VTOYEFI and Ventoy. You need to copy the download Windows ISO image to Ventoy partition.

copy windows iso to ventoy

Once the copying finishes, DO NOT RUSH to plug out the USB just yet. Click on the unmount option from the file manager.

Okay. So now that you have a bootable Windows USB, it will be a good idea to test it out and see if works.

How do you do that? Plug in the Windows USB, reboot your system. When the system is turning on again and showing the logo of your system’s manufacturer, press F2/F10/F12 keys to access the BIOS settings.

When you are in the BIOS, choose to boot from the USB. In some cases, you may have to disable secure boot from the BIOS settings.

select boot from live usb

If the bootable Windows USB creation was a success, you should see Ventoy screen and select to boot into Win10.

booting windows with ventoy

After this, you’ll see some screen about Windows installation. Don’t go with the installation part yet. Close it and power down your system and then boot into Linux again.

This check was necessary because you need to have a working bootable Windows USB. Without that, there will be no point in following the rest of the tutorial.

Remove the bootable Windows USB at this stage.

Step 2: Create a live Ubuntu Linux USB

You may wonder why you need a live Ubuntu USB here when you already have Linux installed properly.

The reason is that you need to modify the existing partition and make some free space where you’ll be installing Windows. But you cannot modify an already mounted partition in Linux. When you are using Linux, your disk is mounted. You won’t be able to modify it and create a new partition in it.

This is why you need a live Linux USB. You boot from the live USB and make the necessary partition on the disk from the live session.

Now that you know the reason, let’s go on with creating live Ubuntu USB. First, download the ISO image of Ubuntu from its website. Any version of Ubuntu will work.

Now, plug in the USB with at least 4 GB in size.

On Ubuntu, you can find the Startup Disk Creator tool. You may also use Etcher on Linux. The choice is yours. Here, I’ll use Startup Disk Creator.

startup disk creator

The process is really simple. Your plugged in USB should be recognized. It should also automatically find the Ubuntu ISO. If not, you can always browse to it. With that set, just hit the “Make Startup Disk” button.

creating live usb ubuntu startup disk creator

It should take a few minutes to create the live Ubuntu USB. You can hit the Quit button below.

live usb created in ubuntu

Step 3: Boot from live USB and make free space for Windows

Alright. Now you boot from the live Linux USB.

Restart the system. When it is powering on and displaying the manufacturer’s logo, press F2/F10/F12 keys to access the BIOS settings. In here, go to the boot order and boot from the Linux USB.

boot from live usb

When you see this screen, go for Try Ubuntu.

Try Ubuntu via live USB

Now that you are in the live session, open the Disk application. It is already installed.

run disk partition tool ubuntu

In the Disks application, carefully select the main hard disk/SSD of your computer. This is where you have Linux installed. As you can see in the picture below, I have ESP partition (for UEFI boot settings) and a single Linux partition. This is the partition that needs to be resized to make free space for Windows.

resize disk ubuntu via live session

If you have a root, swap and home partition setup, you should resize the home partition.

In the resizing, it will show a minimal size. You cannot shrink the disk below this point. You’ll be leaving some extra space for Linux usage, of course.

Note that the “partition size” is for Linux partition. In the picture below, I reduced the Linux partition to 120 GB from 256 GB. This gives a 136 GB of free space for Windows installation.

resizing disk ubuntu via live session

When you hit the resize button, it could take up to a couple of minutes to complete the resizing process.

As you can see in the picture below, now I have three partitions on my system. One is 500 MB of ESP partition (for UEFI boot), 120 GB of Ext4 partition for Linux and 136 GB of free space.

disk resized linux

You now have dedicated free space where you are going to put Windows. Shut down your system now.

Step 4: Boot from Windows USB and start installing Windows

Plug in your bootable Windows UBS. Once again, restart your system, access the BIOS settings and boot from the USB. By now, you know how to do this. You already did this in step 1 while checking the bootable Windows USB.

select boot from live usb

You should see the Ventoy screen if you created the bootable Windows USB with it. Hit enter.

booting windows with ventoy

You should see the Windows logo. After a few seconds, you’ll see the option to choose the language, time and keyboard.

installing windows

The next screen will give you the option to start the installation. Hit “Install Now”.

Installing windows after Ubuntu

In the next few screens, it will ask for the Windows license key. If you don’t have it, skip it. You can activate Windows later as well. You’ll be asked to choose a Windows version and accept the end user license.

installing windows 3

Enter license key or skip it / Choose Windows version / Accept terms and agreement

In the next screen, go with the Custom install option.

custom windows install

Now you’ll come to the partition screen. Select the free space (unallocated space) you had created in the step 3 and hit the Next button.

Installing windows after Ubuntu

It will take a couple of minutes in copying the files and install Windows.

Installing windows after Ubuntu

After that, your system will restart automatically and this time it will boot into Windows directly.

Windows installation is not over entirely. On the next boot, you’ll be asked to configure Windows for your usage and this is super annoying but super easy to follow.

I am not going in detail for this part because I know you can handle the configuration part, which is waiting and hitting next button most of the time. I am sharing a few screenshots just for the reference, though.

Once you have installed Windows successfully, chances are that you’ll be booting into Windows by default. You need to get the Grub dual boot screen back.

Step 5: Get the Grub bootloader back

Once again, restart your system and when it is powering on, go to BIOS settings. From the boot sequence or boot order, move Ubuntu up the order. You may have to use arrow keys or F5 or F6 and the screen may look different for different system.

change boot order ubuntu windows

Save and exit and this time you should be booting into Ubuntu. The battle is not over yet. The grub bootloader might not be aware of the presence of Windows. This is why it is a good idea to update grub in Ubuntu.

All you have to do is to open a terminal and use the following command:

sudo update-grub

Restart your system once again. You should be greeted with the familiar grub boot screen that gives you the option to choose between booting into Ubuntu and Windows.

Dual Boot Grub Screen

Don’t see Windows Boot Manager in Grub?

Install os-prober (usually installed already) and then edit the /etc/default/grub file to add GRUB_DISABLE_OS_PROBER=false to this file. Save this file, update grub and Grub should see Windows option in the grub screen now.

Did you succeed?

And that brings us to the end of this long journey. It takes some time and effort, but if you want to install Windows after installing Ubuntu, this can surely be done.

If you still have questions, please let me know in the comment section and I’ll try to answer you.

As you know, the most common, and probably the most recommended way of dual booting Ubuntu and Windows is to install Windows first and then Ubuntu. But what if you want to install Windows second on a computer with Ubuntu/Linux already installed?

This guide assumes that you have Ubuntu already installed on your system, and will guide you through installing Windows 7/8/8.1/10 when you have a working Ubuntu/Linux partition.

The problem here is that the Windows installer tends to overwrite Grub bootloader or whatever making only the Windows installation bootable. But the good news is that your Linux partition is untouched, including the original bootloader and the other Grub configurations. So restoring or recovering Grub is just a matter of running a few commands on the terminal.

Install Windows on a Separate Partition

If your Ubuntu installation occupies the entire hard drive, to be able to create free space for the Windows installation, you may have to shrink an existing partition using a disk utility like GParted. GParted comes preinstalled on Ubuntu LiveCD.

Boot into a Windows installation media and complete the installation

Once installed, because of Microsoft’s false assumption that there are no non-Microsoft operating systems you’ll be taken straight into Windows.

Restore / Reinstall Grub 2 with a Ubuntu Live Media

  1. Now boot into a Ubuntu Live/USB or CD.
  2. Open a terminal. (Ctrl + Alt + t)
  3. Use a command like lsblk, blkid or GParted to identify your Linux root, and boot partitions. You may or may not have a separate boot partition.
  4. Find Linux Partitions

     $ lsblk -f
     NAME                  FSTYPE     MOUNTPOINT
     sda                                                                            
     ├─sda1                ext4       /boot
     ├─sda2                ext4       /
     ├─sda3                ntfs       
    

    In my case,

    /dev/sda1 is the Linux boot partition

    /dev/sda2 is the Linux root partition

    /dev/sda3 is the Windows partition

  5. Setup a Chroot Environment

    Now we’ll be repairing our old grub bootloader in a chroot environment.

    Mount your root filesystem under /mnt

     sudo mount /dev/sda2 /mnt/
    

    If you’re using BTRFS (New Linux B-Tree File System) instead of EXT4, the above command should change to
    sudo mount -t btrfs -o subvol=@ /dev/sda2 /mnt/

    Run ls /mnt to verify that the correct partition is mounted. It should list the content of your root.

     $ ls /mnt
     bin   dev  home        lib64       media  opt   root  sbin  sys  usr  vmlinuz
     boot  etc  initrd.img  lost+found  mnt    proc  run   srv   tmp  var  vmlinuz.old
    

    Mount the boot partition. (SKIP if you don’t have a separate boot partition)

     sudo mount /dev/sda1 /mnt/boot
    

    If you have an EFI partition you should mount that also. It is basically a small FAT32 partition around 100mb. Please refer to the section on how to reinstall Grub in an EFI system.

    Bind these directories, so grub can detect other operating systems, like so.

     sudo mount --bind /dev /mnt/dev
     sudo mount --bind /dev/pts /mnt/dev/pts
     sudo mount --bind /proc /mnt/proc
     sudo mount --bind /sys /mnt/sys
    

    Let’s chroot into our existing Ubuntu/Linux system on the hard disk.

  6. Reinstall Grub.

     grub-install /dev/sda (specify the disk `/dev/sdX`, not `/dev/sdaX`)
     grub-install --recheck /dev/sda
     exit
    

    Once you’ve successfully reinstalled Grub, restart the computer. On next reboot Grub will be the default bootloader and you’ll be presented with a list of operating systems to choose from (Ubuntu and Windows, of course).

Reinstalling Grub in an EFI Based System

Reinstalling Grub bootloader in a UEFI based computer is no different from installing Grub on a legacy BIOS system. Here we also mount the EFI partition before chrooting, as we’d do with the boot partition.

Case #2
$ lsblk -f
NAME                  FSTYPE     MOUNTPOINT
sda                                                                            
├─sda1                ext4       /boot/efi
├─sda2                ext4       /
├─sda3                ntfs       

Here /dev/sda1 is the EFI partition and /dev/sda2 is the root.

sudo mount /dev/sda2 /mnt/

Mount EFI partition under ‘/mnt/boot/efi’

sudo mount /dev/sda1 /mnt/boot/efi

Forgetting to do so will result in errors being thrown while trying to execute grub-install: “/boot/efi does not appear to be the EFI partition”

As shown previously, bind the /dev, /dev/pts, /proc, and /sys directories.

Finally,

sudo chroot /mnt
grub-install
exit

In some rare occasions, Grub might not detect Windows. In that case just login to Ubuntu (installed one on the disk, not the bootable Live USB/CD) and execute,

sudo os-prober
sudo update-grub
sudo reboot

Happy Dual-Booting!

In this article we will see how to install Windows in dual boot mode on a computer on which Ubuntu is already installed. We will install Windows over Ubuntu. Then repair GRUB boot loader to access Windows as well as Ubuntu in dual boot mode. It is a common practice to install multiple operating system on a computer. Generally, users install Windows and Linux Operating Systems in dual boot mode on their computers.

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:

Multiple Partitions in Ubuntu

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:

Disks Application in Ubuntu

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:

Disks Application in Ubuntu Steps A

Disks Application in Ubuntu next Steps

As a result of above steps, free space will appear after Partition 2 as shown below in green box:

Free Disk Space after Resizing Secondary partition Ubuntu

Close the ‘Disks’ application on successful resizing and un-allocation of disk space for Windows OS.

Watch above process in Video: How to resize secondary partition and un-allocate space in Ubuntu

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:

  1. On existing Ubuntu system using Startup Disk Creator
  2. On Windows system:
    • using Balena Etcher Flashing Software
    • using Rufus Software
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:

Try Ubuntu

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 in Ubuntu Live Session

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:

GParted Partition and Resize Button in Ubuntu

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:

Initial Slider Gparted Ubuntu

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:

Dragged Slider Gparted Ubuntu

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:

Unallocated space and Apply button Gparted Ubuntu

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:

Freee Disk Space after Resizing Primary partition in Ubuntu

Watch above process in Video: How to resize primary partition and un-allocate space in Ubuntu

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.

Note: Check out methods to create windows bootable Flash Drive on existing Windows. You may also check how to create windows bootable Flash Drive on existing Ubuntu Linux.

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.

i dont have a product key windows

Special Note: Always buy Windows or any other software from authentic source only. You can always buy Microsoft Windows DVD online from Amazon directly from Microsoft account. If you wish, you may checkout available options for Microsoft Windows DVD online at Amazon.

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.

Partitions in Windows setup

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:

Partition for Windows installation

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

sudo apt update

After updating the package database, type following command to install ‘Boot-Repair’ application:

sudo apt install boot-repair

Enter root password and press ‘Y’ or ‘Enter’ key when prompted. After installing ‘Boot-Repair’ application, run ‘Boot-Repair’ application by typing following command:

boot-repair

The boot repair application will open from terminal prompt. Click on ‘Recommended repair’ button as shown in below image:

Recommended Repair button in Boot Repair Application

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:

Windows and Ubuntu Dual Boot GRUB Boot Loader

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.


Раньше я писал статью о том, как установить Linux после Windows, это довольно простая задача. Но многие пользователи удаляют Windows, ставят Linux, а потом понимают, что им снова нужна Windows. Вот только установить Windows на компьютер, где уже расположился Linux, немного сложнее.

При установке Linux автоматически определяются загрузчики других операционных систем, и добавляются в меню загрузки. Таким образом, вам не надо ничего дополнительно настраивать, чтобы запустить свою Windows. Но если вы устанавливаете Windows поверх Linux, то будет использован загрузчик Windows, и получить доступ к Linux без дополнительных настроек вы не сможете. Однако эта проблема вполне решаемая, и в сегодняшней статье мы поговорим, как правильно инсталлировать Windows после Linux.

1. Разметка диска в Linux

Для установки Windows 10 после Linux вам нужно свободное пространство на диске, как минимум 50 гигабайт, а то и больше, если хотите устанавливать туда много игр и программ. Современные версии Windows хотят создавать два раздела:

  • Системный;
  • Раздел с данными для восстановления;

Но тут надо учитывать один момент, если у вас используется таблица разделов MBR, то основных разделов может быть только четыре. И если у вас уже есть корневой раздел, домашний и swap для Linux, то раздел восстановления получается пятым, а это уже проблема, поэтому нужно создать расширенный раздел и уже там размечать разделы для Windows. Если вы ставите эту ОС на другой жёсткий диск, то никаких проблем нет, но я предполагаю что обе системы устанавливаются именно на один диск.

Во-первых, нам необходимо загрузиться с LiveCD, поскольку надо уменьшить размер либо корневого раздела, либо домашнего, а эти диски примонтированы. Самый простой способ это сделать — загрузиться с Live системы.

Загружаем наш диск, например Ubuntu, и запускаем Gparted:

Затем нужно уменьшить раздел. Для этого выберите нужный и кликните Изменить или переместить:

Затем уменьшите раздел так, чтобы после него оставалось 40-50 гигабайт:

Далее выберите свободное пространство и щёлкните в контекстном меню пункт Новый:

Помните, я выше писал, что с таблицей разделов MBR можно создавать только четыре основных раздела. Поэтому из свободного пространства создаём расширенный раздел. Выберите в поле Создать как -> Расширенный раздел:

Выберите всё доступное место, а потом нажмите Ок:

На этом в Gparted всё. Далее нам необходимо нажать зелёную галочку или Правка -> Применить изменения, а потом дождаться завершения всех операций.

2. Разметка диска в Windows

Теперь надо разобраться, как поставить Windows после Linux. Я не буду рассматривать все шаги установщика Windows. Вы их и так знаете. На шаге выбора раздела для установки кликните по свободному месту, которое подготовили раньше. Система не будет показывать расширенных разделов и других дополнительных параметров диска, только размер, это для неё нормально.

Затем нажмите кнопку Создать и выберите размер раздела. Можно согласиться с тем, что предлагает установщик:

Затем согласитесь на создание дополнительных разделов для системных файлов:

Дальше выбирайте только что созданный системный размер и нажимайте Далее. Осталось дождаться завершения установки.

3. Восстановление загрузчика Linux

После того, как вы окажетесь на рабочем столе Windows, работа с Windows будет завершена, и вам надо снова загрузиться с LiveCD Ubuntu или дистрибутива Linux, который у вас установлен. Дальше мы будем выполнять действия, описанные в статье о восстановлении загрузчика Grub.

Сначала нам нужно примонтировать корневой раздел с Linux, в моём случае это /dev/sda1:

sudo mount /dev/sda1 /mnt

Если раздел /boot у вас также существует отдельно, его тоже надо примортировать. Затем подключаем подсистемы взаимодействия с ядром в папку /mnt, куда мы раньше примонтировали корень:

sudo mount --bind /dev/ /mnt/dev/
sudo mount --bind /proc/ /mnt/proc/
sudo mount --bind /sys/ /mnt/sys/

И переходим в окружение нашего установленного ранее Linux с помощью команды chroot:

sudo chroot /mnt/

Далее мы можем заняться восстановлением загрузчика. Сначала установим его на диск:

grub-install /dev/sda

Затем создадим новый конфигурационный файл, в котором уже будет наша только что установленная Windows:

update-grub2

Дальше осталось перезагрузить компьютер:

Теперь в качестве загрузчика будет использоваться Grub2 и в списке операционных систем отобразится Ubuntu и Windows, чего мы и добивались:

Выводы

В этой статье мы рассмотрели, как выполняется установка Windows после Linux. Это довольно нетипичная ситуация, но для многих пользователей информация может быть полезной. А вы используете Windows рядом с Linux? Напишите в комментариях!

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Creative Commons License

Статья распространяется под лицензией Creative Commons ShareAlike 4.0 при копировании материала ссылка на источник обязательна .

  • Install windows 7 professional clg
  • Installed key для windows 10 что это
  • Installshield wizard скачать для windows 10
  • Install windows 11 without internet
  • Install the english united states language pack under language settings in windows