Grub2 » Historie » Version 2
Jeremias Keihsler, 12.01.2017 14:38
| 1 | 1 | Jeremias Keihsler | h1. Grub2 disaster recovery |
|---|---|---|---|
| 2 | |||
| 3 | h2. Requirements |
||
| 4 | |||
| 5 | To install such a system you will need the following: |
||
| 6 | |||
| 7 | * Download @Fedora 18 Live DVD@ or a newer version of Fedora supporting Grub2 and burn it on an empty CDROM (the .iso can be found here: http://fedoraproject.org/get-fedora) |
||
| 8 | * a bootable CDROM-drive |
||
| 9 | |||
| 10 | alternatively you might use a bootable USB-drive created with the @Fedora LiveUSB Creator@ |
||
| 11 | |||
| 12 | h2. Preliminary Note |
||
| 13 | |||
| 14 | It is assumed that |
||
| 15 | * the first harddrive (@sda@) is the system-drive. |
||
| 16 | * the root filesystem to be recovered is in a logical group/volume called @/dev/vp_p2600f18/lv_f18_root@ |
||
| 17 | * the boot filesystem to be recovered is in a partition called @/dev/sda8@ |
||
| 18 | These settings might differ for you, so you have to replace them where appropriate. |
||
| 19 | |||
| 20 | Some very important information is take from https://fermilinux.fnal.gov/documentation/tips/mount-bind-chroot |
||
| 21 | |||
| 22 | *Many times when you are fixing a machine, you need to chroot into it. Many of those times the programs you run (such as grub-install) will need the /proc, /dev, and /sys directories to be alive and well. This is when you need to use bind.* |
||
| 23 | |||
| 24 | 2 | Jeremias Keihsler | h2. Start Fedora 18 Live DVD |
| 25 | 1 | Jeremias Keihsler | |
| 26 | list all partitions |
||
| 27 | <pre><code class="bash"> |
||
| 28 | fdisk -l |
||
| 29 | </code></pre> |
||
| 30 | |||
| 31 | list all logical volumes |
||
| 32 | <pre><code class="bash"> |
||
| 33 | lvdisplay |
||
| 34 | </code></pre> |
||
| 35 | |||
| 36 | create a base directory for the system to be rescued |
||
| 37 | <pre><code class="bash"> |
||
| 38 | mkdir /mnt/f18 |
||
| 39 | </code></pre> |
||
| 40 | |||
| 41 | mount the 'root'-filesystem |
||
| 42 | <pre><code class="bash"> |
||
| 43 | mount /dev/vp_p2600f18/lv_f18_root /mnt/f18 |
||
| 44 | </code></pre> |
||
| 45 | |||
| 46 | mount the 'boot'-filesystem |
||
| 47 | <pre><code class="bash"> |
||
| 48 | mount /dev/sda8 /mnt/f18/boot |
||
| 49 | </code></pre> |
||
| 50 | |||
| 51 | bind the /proc, /dev, /sys into the to be rescued 'root'-filesystem |
||
| 52 | <pre><code class="bash"> |
||
| 53 | mount -o bind /proc /mnt/f18/proc/ |
||
| 54 | mount -o bind /dev /mnt/f18/dev/ |
||
| 55 | mount -o bind /sys /mnt/f18/sys |
||
| 56 | </code></pre> |
||
| 57 | |||
| 58 | chroot and install Grub2 |
||
| 59 | <pre><code class="bash"> |
||
| 60 | chroot /mnt/f18 |
||
| 61 | grub2-install /dev/sda |
||
| 62 | exit |
||
| 63 | </code></pre> |
||
| 64 | |||
| 65 | restart the machine and test the result |