Restoring backups and effect on GRUB

Rashkae ubuntu at tigershaunt.com
Mon Aug 5 22:00:50 UTC 2019


On 2019-07-27 4:15 p.m., Kevin O'Gorman wrote:
> I'm working on backup scripts, and want to make sure I understand the
> consequences of what I'm doing.  In particular, I have still not decided
> how I'm going to back up my / partition: tar/dar or dd,
> and I'm wondering what effect there is on GRUB if a partition is moved,
> resized, or restored from a  tar/dar archive, because I'm thinking some
> of the above operations would change where the kernel is.  I'm unclear
> about how GRUB locates the kernel and any other boot files, and whether
> it can follow the directory structure or if instead it knows the LBA
> blocks where the files were originally stored.
> 

This will depend a great deal on whether or not your are booting with
Legacy Bios or EFI.  EFI makes life *much* easier, but it's taking a
long time for people to leave their comfort zone... We've been using
BIOS for a very long time.


While it's certainly possible to restore your root from a tar backup and
convince grub to repair itself,  this will probably require booting from
media to fix things up.  Make sure that you at least have a copy of
Linux Rescue CD (even if you're using it from USB stick, thats fine)
that works with your system.  Also remember, that if you intend to boot
EFI, the boot media must *also* be booted in EFI mode.


One important thing to keep in mind, to get a full copy of your root
filesystem, you must re-mount it somewhere else.  It might seem
reckless, but in Linux, you *can* mount filesystems twice.  So, for
example, your rout filesystem is on /dev/sda2

mkdir /mnt/sda2
mount /dev/sda2 /mnt/sda2

Now you can back up the contents of the /mnt/sda2

The reason for this is that the root filesystem has many files, like
devices nodes under /dev that will not get backed up from / because they
are covered by udev mounted at /mnt.  There used to be some stuff in
/proc or /sys, I forget but that that seems to be gone now.

>From there, manually restoring the system from such a backup can be a
bit of a technical thing.  Sorry, I just don't have a tutorial I can
whip out.  But I would suggest you just try to do it... Put in a fresh
HDD, (or use a second computer, linux can be pretty good about that,)
and restore from your backup.






More information about the ubuntu-users mailing list