1

I've been trying to use Ubuntu's "Disks" program to create images of partitions on my friend's laptop and then restore them without success. I take backups onto an external hard drive, then delete all partitions on the laptop, create empty partitions with the exact number of original bytes and restore the images from the external HDD, but Windows isn't even able to find its own bootloader and so I can't boot.

So now I'm trying something different. She doesn't use Windows anyway, so I'm going to leave the Windows partitions intact, and chose sda7 to install the the Ubuntu 16.04 bootloader.

enter image description here

Now in BIOS I can see a separate Windows bootloader and the Ubuntu grub64 file which I selected as the trusted UEFI file for bootloading. So now she has a dual-boot system.

Now I want to try creating a clone of sda7 (using Ubuntu's "disks" app), so that even if I delete partitions sda7, sda5 and sda6 and then re-create them and restore sda7's clone, I should be able to select the bootloader of sda7 from BIOS as the trusted bootloader and have a dual-boot system as before.

But before doing that, I want to verify if the bootloader is really in sda7. I tried doing grep -r "grub" . from the root folder, but that's probably the wrong thing to look for, so could you help with this? How do I make sure the bootloader is in sda7? Which files are those?

  • The GRUB bootloader is not in the filesystem (GRUB runs before the filesystem is loaded). Partitions do not have individual bootloaders. See askubuntu.com/questions/142912/…. – user535733 Jun 13 at 5:25
  • Generally when total redoing a system, you need to totally reinstall grub. UEFI uses GUID to find correct ESP - efi system partition your sda1. So if sda1 reformatted, you have to update GUID in UEFI, by deleting old entry & creating new. And then grub entry in /boot/efi/EFI/boot/grub.cfg has UUID of install. So again if partition reformatted UUID will change & has to be updated. Can be done manually, but just easier to totally reinstall grub2 in UEFI boot mode. And still easier to use Boot-Repair's advanced mode to totally reinstall grub – oldfred Jun 13 at 13:40
  • @oldfred: Aha! This was crucial info I was looking for. So if I use CloneZilla or even dd to backup an entire drive or the partitions containing the OS and EFI system partition, I'd still have to reinstall grub? Is there any documentation online that explains how to do these? I've been having a lot of trouble with getting Windows or Ubuntu to find the bootloader everytime I try. – John David Jun 13 at 14:39
  • If you use dd, then everything is identical including GUID & UUIDs. But dd can be dangerous to use as its nickname is Data Destroyer. Any typo or use of wrong drive totally overwrites that data. And any duplicate drive cannot be still mounted when rebooting, as then you have duplicate UUIDs which are not allowed. I have not used CloneZilla but believe it works much better as dd copies unallocated space and then is much slower. You boot from UEFI boot menu. help.ubuntu.com/community/Boot-Repair & sourceforge.net/p/boot-repair/home/Home – oldfred Jun 13 at 16:02
  • OMG! I'm surprised I haven't heard of boot repair until now. Thank you! Lemme try these tools. – John David Jun 14 at 4:52
0

The bootloader that is run by your UEFI bios is not loaded from /dev/sda7, but from your EFI partition, /dev/sda2. Your current system has this partition mounted at /boot/efi/. Search this partition as root to find the grub binary and grub cfg file.

This cfg file points grub to your boot partition, and then to another autogenerated cfg file you can see at /boot/grub/grub.cfg. This cfg file contains all the data used to build the grub boot menu and is written when you type "sudo grub-install" from within linux.

0

First, you would rather double check that you are actually booting with EFI and no the old BIOS:

[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

If you are acutally booting with EFI, the GRUB files are stored:

  • in the ESP partition (in /EFI/ubuntu)
  • in /boot/grub
  • in /etc/grub

so yes /dev/sda7 holds some GRUB files most like the ones in /etc/grub and /boot/grub.

I am not 100% sure about that but if /dev/sda7 is wiped /boot/grub/grub.cfg will be missing and GRUB will not work properly.

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.