install a second hard drive with ubuntu alongside windows 10

I currently use a computer with one hard drive where Windows 10 is installed. I would like to put a second hard drive into my computer, with Ubuntu installed on it, and choose which OS I would like to boot when starting my computer. Ubuntu is already installed on the second hard drive, but is not in the computer yet.

My question is : Do I have to configure anything or can I just put the second hard drive in my computer, and when I will turn it on again my screen will ask me automatically in which drive I want to boot ?

Asked By: Alexis Pister

||

… when I will turn it on again my screen will ask me automatically in which drive I want to boot? Your PC will not automagically ask, and depending on your BIOS/firmware, the process to select the drive will vary. You will need to press whatever key is used for Boot Selection (F10 and F11 are common), then select the drive to boot from.

Answered By: K7AAY

Presuming that your external hard drive that you said has Ubuntu installed has data that you want to keep. I recommend you boot with Grub, this is how I dual boot Ubuntu on my Windows 10 laptop.

What you need to do is:

  1. Create a live Ubuntu USB stick
  2. Boot into Ubuntu on the live USB stick and configure networking
  3. Create a directory called /target on the live USB stick
    sudo mkdir /target
  4. Attach and mount your external hard drive on /target. If it auto mounts someplace else, just sudo umount /mnt/someplaceelse and mount it on /target.
    Eg. sudo mount /dev/sdb1 /target # If /dev/sdb1 is your external hard drives primary partition
  5. Make a directory on /target if it does not already exist called /boot/efi
    $> sudo mkdir -p /target/boot/efi
  6. Bind mount critical live USB directories onto /target:
    $> for a in /sys /proc /run /dev; do sudo mount --bind "$a" "/target${a}"; done
  7. Use gparted to determine the location of the efi partition on
    your windows hard drive
    $> sudo gparted /dev/sda # If /dev/sda is your windows hard drive
  8. Mount the Windows Boot Manager efi partition on /target/boot/efi:
    $> sudo mount /dev/sdXY /target/boot/efi
  9. Chroot to /target:
    $> sudo chroot /target
  10. On chroot:
    $> sudo apt-get update
    $> sudo apt-get install grub2
    $> sudo update-grub2
    $> exit
  11. Reboot:
    $> reboot
  12. While rebooting pull the USB thumbdrive out of your computer – you should be brought back into Ubuntu this time on the external hard drive (not the USB thumbdrive)
  13. Re-run an update of grub2:
    $> sudo apt-get update
    $> sudo update-grub2

Done.

Note: if you have trouble for any reason and you want to boot into Windows just hit escape and you should see the bootloader option screen and select Windows. If not just go into your Bios and change the boot load priority.

Answered By: Adam D.
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.