2

I have this situation:

HDD 1: Windows 10 installation (personal use) HDD 2: Windows 10 installation (work use) HDD 2 Partition 5: Ubuntu Installation (don't care, but needed for grub)

I cannot boot my personal installation and hibernate it, then switch to work use, and vice versa. This is because of hibernating drives can be mounted outside of their boot session and can cause data corruption - but not really cause I don't mount these drives.

I want to be able to hibernate personal use, then switch to work use, and vice versa. Grub bootloader ALLOWS this. But, there is a 10GB partition for Ubuntu. I would really love to make say a 200MB partition to ONLY install the necessary grub files onto. How can I do this?

Seth
  • 131
  • Have a look here; https://askubuntu.com/questions/1227221/simple-hand-made-persistent-usb-that-boots-either-bios-or-uefi – C.S.Cameron Jan 30 '21 at 04:15
  • @C.S.Cameron grub-install: error: will not proceed with blocklists This was me trying to install grub to the /dev/sda after sudo mount /dev/sda5 /mnt. Basically, what I would LOVE to do, is install grub but that is it, do not copy anything else from the live USB that is running ubuntu – Seth Jan 30 '21 at 04:46
  • Do you not need boot/grub/grub-cfg in order to hibernate? I guess if you are using a swap partition you do not need resume_offset=... I figured, when using my link, you would just use the boot and EFI folders and ignore everything else. I have not tried what you are doing though. but it does sound interesting. If you get it working, please post your method and I will upvote. I have not seen the blocklists error before. – C.S.Cameron Jan 30 '21 at 05:07
  • @C.S.Cameron, I am trying to get rid of my ubuntu installation. The only reason I installed ubuntu was for the grub bootloader. I think I might try "repairing" a grub install onto a partition that is blank. This should copy all the necessary files over – Seth Jan 30 '21 at 05:14
  • Can you not just delete all of Ubuntu except the boot folder and then shrink it's partition? – C.S.Cameron Jan 30 '21 at 05:46
  • @C.S.Cameron, since it is UEFI, there is an actual boot partition. There are files inside the / root directory of the 10GB partition that are required for grub. As I have tried to do what you just said already :) lol – Seth Jan 30 '21 at 05:53
  • Are the files inside the EFI boot partition enough by them selves? I usually keep the other files found in the ISO's /boot/grub/ folder and EFI folder, but then I am usually trying to make a drive that boots both BIOS and UEFI. – C.S.Cameron Jan 30 '21 at 06:09
  • If two Windows installs and each has separate ESP - efi system partitions, you should have two "Windows" boot entries in UEFI. One for each system. Do not know how to see details from Windows, but from Linux you use sudo efibootmgr -v and you can see GUID each uses. GUID aka partUUID: lsblk -o name,mountpoint,label,size,fstype,uuid,partuuid | egrep -v "^loop" And compared GUID & partUUID. This installs UEFI grub to FAT32 ESP. Do not run mklabel as that erases drive. https://unix.stackexchange.com/questions/631048/how-to-install-grub-to-empty-disk-from-ubuntu-livecd/631107#631107 – oldfred Jan 30 '21 at 15:13
  • @oldfred, sadly, BIOS only sees the LAST installed windows boot location. I read somewhere why this is, cause I did install windows to hdd1, unplug hdd1, install windows to hdd2. Grub can see both installs, but bios cannot. – Seth Jan 30 '21 at 16:15
  • @C.S.Cameron, so I am not sure on that. If I try to install grub from terminal inside live ubuntu it fails. What would be nice is to comb through the installation process of ubuntu itself and extract just the grub stuff – Seth Jan 30 '21 at 16:16
  • Have seen users with two separate Windows installs and able to boot from each directly from grub. But you have to have both in primary NTFS partitions if BIOS. You temporarily change boot flag or if UEFI, change ESP. I can provide links to users who have made it work that posted details. – oldfred Jan 30 '21 at 21:12
  • @oldfred, yes, booting from GRUB is not a problem at all. It was from BIOS that both installations of Windows were not detected. I got it all sorted now though, thank god. – Seth Jan 30 '21 at 21:20

1 Answers1

1

I finally got this figured out, thank you all for the links and help in this stupid problem lol. I would love if there was a "grub only" iso that you could install, but sadly there is not.

SOLUTION:

  1. Install Windows onto HDD1, unplug HDD1, install windows HDD2.
  2. Plug in HDD1
  3. Make a 10GB partition on any of the drives
  4. Install Ubuntu to that partition
  5. Make sure Grub is installed and working (you can boot back and forth between windows installs)
  6. Boot from live linux USB (choose "try ubuntu")
  7. Mount the partition that has the full ubuntu installation on it.
  8. Using thunar, delete everything, EXCEPT - /boot and /etc/grub*
  9. Use gparted to shrink the ubuntu partition to 100MB
  10. Use gparted to extend the windows installed partition
  11. Sadly, windows won't automatically see this partition change, so I ran chkdsk on it and that fixed the incorrect partition sizes being reported. I think there is another way to refresh that tho.

We now have GRUB as my bootloader showing both versions of windows allowing me to pick between each either at a full power off (shut down) or after a hibernate. I am finally happy lol.

NOTE: Grub makes it's own partition to hold the UEFI boot stuff in it. This partition is what shows up in the BIOS boot menu of your device.

PS: You can take a backup of the drive and if ever need to redo the process, you can simply make a 100MB partition and copy the backup back, then use the live usb to reinstall GRUB.

EDIT: have not tested, but diskpart > rescan drives should update the partitions without doing a full ckdsk

Seth
  • 131
  • 1
    +10 as promised, thanks for the step by step. What code did you use to reinstall GRUB? – C.S.Cameron Jan 31 '21 at 02:12
  • 1
    @C.S.Cameron, if any of the partitions become corrupt (grub's boot partition, or the partition holding boot information (the 100MB one in my example)), this solution should work - https://askubuntu.com/questions/831216/how-can-i-reinstall-grub-to-the-efi-partition. You basically remount and restore the partitions holding the grub information, and the new efi partition should get created and point to the partition holding the information – Seth Jan 31 '21 at 18:01