I would like to install ubuntu 16.04 on Hard drive, but I want to keep windows 7.

What I want is to install ubuntu on a partition of the HDD, but I want it only to boot if I plug in USB Drive, and if I don't plug in the USB drive, it will boot directly to windows 7.

Let's say I have 50 Gb of free unused Space and the rest of space is used for Windows 7 OS.

So I install Ubuntu 16.04 on the 50 Gb of free space, but I don't want it to replace windows bootloader, I want ubuntu boot GRUB to be installed on USB such that I can only boot to Ubuntu if I plug in the USB drive.

Please help and thanks.

  • I have seen several users do just that because they had encrypted Windows and you cannot install grub to MBR as MBR is either locked or proprietary code and grub could not chain load to it. You just use Something Else during install. You need two flash drives, one as installer & one to install MBR into. Flash drive with grub can be used for data. You can also do a full install of grub only but then have to create your own grub.cfg. Just be sure to choose flash drive for where to install boot loader. askubuntu.com/questions/343268/… – oldfred Jun 2 '16 at 13:38

There is a way to achieve similar behaviour if you are interested in booting Windows most of the time but occasionally booting into Ubuntu.

You are able to change the behaviour of the Grub bootloader to automatically select the last booted Operating System by default. So, for example, if you booted up Windows last time, then it will boot up Windows again.

When grub first loads, there is a timeout (usually 10 seconds but can be changed) and if you don't select an operating system before this time, it will boot up the default.

In order to get grub to default to the last selected Operating System, you need to adjust the file that is located in /etc/default/grub.

sudo nano /etc/default/grub is probably the easiest way to edit this file.

You want to change the line GRUB_DEFAULT=0 to GRUB_DEFAULT=saved and also add the line GRUB_SAVEDEFAULT=true

When you've exited and saved the file, run sudo update-grub and on your next reboot the default choice for grub will be the last booted Operating System.

For Legacy boot, installing Ubuntu (and subsequently the grub bootloader) does technically replace the 'Windows bootloader' ("GRUB 2 normally writes its bootloader information to an area just beyond the Master Boot Record and before the first partition" which is where the 'Windows bootloader' would be) but grub will load Windows quite happily when selected.

With a UEFI boot of Windows, it doesn't even replace the Windows bootloader. Grub becomes the first UEFI boot option and if Windows is selected then Grub just points it to the Windows Boot Manager and away you go.

The 'Windows bootloader' (or Windows Boot Manager as they seem to call it) isn't replaced or changed, your machine just loads grub first.

Here is an example of what my grub bootloader shows me:

enter image description here

I mention all this because you say you 'don't want to replace the Windows bootloader' but unless there is a particularly complicated reason for why you don't wish to do this, then having the grub bootloader installed on your Hard Disk should not cause any problems.

By changing the grub default choice, you will have almost the same behaviour that you are after, but with a short delay of a few seconds as grub waits for you to choose.

This will also mean you don't have to go get the USB every time you want to boot Ubuntu.

(Something worth mentioning is that if your Windows installation is using UEFI, then when you are installing Ubuntu you will want to press f12 to get the 'one-time boot menu' up and then select the USB under the UEFI Boot options, to ensure that Ubuntu is installed as UEFI also.)

Here is a picture to show you what I mean, with the 'UEFI: TDK' being the USB stick I am wanting to use:

enter image description here


The following method is not very elegant, but it is easy.

Use mkusb to make a Persistent USB of any handy Ubuntu ISO file.

Take the USB drive into gparted.

Delete all USB partitions except the 125MB fat32 partition, the one with the Boot Flag.

Remove the Boot Flag.

Copy the UUID of the internal Ubuntu partition while in gparted.

Close gparted.

(You can also open the grub.cfg file of the internal drive with a text editor and copy UUID and kernel version, if there is an internal grub.cfg file).

Open boot/grub/grub.cfg of the USB with a text editor

Replace the existing menuentries with the following:

menuentry "ubuntu" {
      search --no-floppy --fs-uuid --set=root uuid-number-of-your-internal-ubuntu-partition
    linux   /vmlinuz-kernel-version root=UUID=uuid-number-of-your-internal-ubuntu-partition quiet splash --
    initrd  /initrd.img-kernel-version

uuid-number-of-your-internal-ubuntu-partition is the internal UUID and kernel-version is the kernel version of your internal Ubuntu install, (4.4.0-31-generic for 16.04.1).

Go back into gparted and reset the Boot Flag.

You can set this boot flash drive as the first hard drive in grub or hit F12 when booting to choose it.

An alternate method when installing Ubuntu to hard drive is to choose "Something else" when partitioning.

This will allow you to install Ubuntu to HDD and save the boot loader to the Flash drive.


Not really. Check this out for full explaination https://help.ubuntu.com/community/MultiOSBoot


You can do this by turning off the ESP flag on your internal HDD prior to installing Ubuntu, and of course making sure you create an EFI partition on your external drive, and telling the Ubuntu installer that your external drive is the device where you want the boot loader to do. You'd think steps 2 and 3 would be sufficient, but a longstanding bug in the Ubuntu installer will ignore your request to install grub on the external drive if it sees an existing EFI partition on your internal drive. So disconnecting your internal drive works,but you can get the same effect by using gparted to turn off the ESP flag on the internal drive's EFI partition before installing.

Full instructions here: https://askubuntu.com/a/1056079/152287

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.