diff options
authorMatěj Laitl <>2011-10-11 20:55:35 +0200
committerMatěj Laitl <>2011-10-11 20:55:35 +0200
commit7774e7be933cc6498528d492a343083e1c4a14e1 (patch)
parentUpdate guide. Patch from Moritz Schlarb. (diff)
GRUB 2 Guide: add section about backing up a bootloader
1 files changed, 60 insertions, 1 deletions
diff --git a/docs/grub-2-guide.xml b/docs/grub-2-guide.xml
index 8b587d6..02fac52 100644
--- a/docs/grub-2-guide.xml
+++ b/docs/grub-2-guide.xml
@@ -27,7 +27,7 @@ This guide shows you how to install and configure the GRUB 2 bootloader.
@@ -56,6 +56,65 @@ Some examples of new features:
+<title>Optional: Creating Backup of Existing GRUB Legacy Installation</title>
+Playing with bootloader always brings the danger of leaving your system in
+unbootable state. Fortunately no data is lost in most cases and recovery is not
+hard, but we recommend you to have a bootable CD, DVD or a USB flash disk with
+Linux around (<uri link="">Gentoo
+LiveDVD</uri> or <uri link="">System Rescue CD</uri>
+will do) and to backup your current bootloader setup. If your current
+bootloader is GRUB legacy, following code sample may help you backing it up.
+<pre caption="Backing up GRUB">
+# <comment># copy grub modules and configuration</comment>
+# <i>cp -a /boot/grub <keyword>/path/to/backup</keyword>/</i>
+# <comment># backup the MBR and GRUB stage 1.5</comment>
+# <i>dd if=<keyword>/dev/sda</keyword> of=<keyword>/path/to/backup</keyword>/first-sectors count=63</i>
+Replace <c>/dev/sda</c> with device node of the disk you boot from (this is
+usually and the whole disk like <e>sda</e>, not a partition like sda1) and
+<c>/path/to/backup</c> with path to your favourite backup medium.
+When something goes wrong, you can restore previous grub installation by
+booting some Linux live media and issuing following commands.
+<pre caption="Restoring GRUB from backup">
+# <comment># move old grub files out of the way</comment>
+# <i>mv /boot/grub /boot/grub.nonfunctional</i>
+# <comment># copy grub back to /boot</comment>
+# <i>cp -a <keyword>/path/to/backup</keyword>/grub /boot/</i>
+# <comment># replace MBR and next 62 sectors of sda with backed up copy (DANGEROUS!)</comment>
+# <i>dd if=<keyword>/path/to/backup</keyword>/first-sectors of=<keyword>/dev/sda</keyword> count=63</i>
+Replace <c>/dev/sda</c> with device node of the disk you boot from and
+<c>/path/to/backup</c> with path to the place where you've stored your backup.
+Writing directly to disk sectors (even those that are outside of partitions
+in typical setup) is risky operation and will make your data <e>inaccessible</e>
+if you changed your parititon layout between backup and restore. Other slower
+and safer option would be chrooting into your Gentoo installation and
+re-installing bootloader - you can use <uri link="/doc/en/handbook/">Gentoo
+Handbook</uri> for that task.
<title>Setting Useflags</title>