A while back I installed Linux on my SSD, sdb1. I also have a 1 terabyte drive for my home directory, sdc1. I have Windows on another hard drive, sda1, which I haven’t booted into in over 2 years. It is a terabyte in size. I would like to get rid of Windows and utilize that extra space without reinstalling Linux, but Grub is on the Windows hard drive, sda1. What I would like to do is put Grub onto my SSD, sdb1, if possible in order to format the Windows drive, sda1, and have extra space. It is Legacy BIOS on the computer.
I have done a trail with my dummy practical computer with one hdd and one ssd.
I assume, you have installed windows in UEFI boot mode with gpt partitioning type on your hdd. sda.
Since mine is a dummy practical computer, I don't need to worry about backup. I do recommend you to take backup.
I have not considered sdc for separate home partition as I don't have other drive free.
Log on with live session of Ubuntu.
Here are my sda-1tb hdd and sdb-120gb ssd.
I have windows10 on sda and Ubuntu18.04.1 on sdb. Grub is on sda.
You can see windows10 is installed in device sda with EFI partition on sda2. This is what controlling the grub now.
Important: this partition sda2 has UUID matched with the text in the file /etc/fstab on device sdb.
As we are going to format sda. We need to create EFI System Partition on sdb. sdb has only one partition sdb1. We have to create a EFI partition at start of the disk.
Now we got unallocated space of 100mb at start of disk sdb. In order to install grub on this we need it in FAT32 format with boot and esp flags.
Here if you observe, we have created 100mb EFI partition at the start of the disk. which should be named as sdb1. but gparted still shows it as sdb2. to sort out this
sudo sgdisk -s /dev/sdb
Now delete the EFI partition (sda2) on sda or you can format entire device sda.
Now we need to install grub on /dev/sdb.
sudo mount /dev/sdb2 /mnt# mounting root partition. (sdb2 is the ext4 /)
for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
(binding the required folders).
sudo mount /dev/sdb1 /mnt/boot/efi# sdb1 is the EFI partition on sdb.
sudo chroot /mnt
Now we need to know the UUID of freshly created EFI Partition (sdb1) on device sdb.
Open "Disks" app.
Copy the UUID of sdb1.
Open the fstab file.
sudo nano /mnt/etc/fstab. (note: i have used gedit, attached pics are gedit in the below).
paste the UUID at the rite place.
Save and Close.
If you boot Grub in legacy BIOS mode you can (re-)install it to any drive with
grub-install using your current Ubuntu installation. (No need to boot a live system like when you need to reinstall/repair Grub on an unbootable system.)
sudo grub-install /dev/sdX
sdXwith the name that is currently assigned to the drive that you intend to use as boot device in the future.
Configure your BIOS to boot from the drive with the new Grub installation.
There’s no real need to remove the old Grub installation.