GRUB Rescue

GRUB Rescue

2019-01-06. Category & Tags: GRUB, Rescue, Boot, Linux, Ubuntu

When being forced into GRUB rescue mode, run ls and ls <one_partition> to check available partitions and find the one that we should boot from [ref].

Then set prefix & root [ref]:

set root=(hdX,Y)
set prefix=(hdX,Y)/boot/grub
insmod normal
normal

To avoid doing this every time, it is recommened to use a live-USB/ISO to repair GRUB (usually only Desktop version can be in live-USB and easy to setup WIFI). (// it should be also ok to do this without USB if there is a nix system working on current HDD).
Then use boot-repair to repair the grub.

sudo add-apt-repository ppa:yannubuntu/boot-repair && \
sudo apt-get update && \
sudo apt-get install -y boot-repair && \
boot-repair

It will automatically repair it.

System backup #

eg1 to a file:

dd status=progress bs=100M iflag=fullblock  if=/dev/sda | lbzip2 > /home/sda.img.bz2

Note, status=progress requires Ubuntu 16.04 or newer.

askubuntu
computerHope
fullblock

eg2 to another disk/partition:

dd if=/dev/sda of=/dev/sdb & pid=$!
# or:
dd if=/dev/sda of=/dev/sdb 2>>/home/file.txt & pid=$!
watch -n 10 kill -USR1 $pid

WARN: USR1 for Linux, SIGINFO for OSX (USR1 will still kill the pid in OSX).

titanwolf tee