Fedora Linux: Boot a system from grub prompt

By | February 19, 2016

I had a situation when from a strange reason a default grub setup as a result of a system recovery was missing the lvm and raid modules so I was not able to boot.
I have the following setup on the server:
– my boot partition is in fact an ext4 partition over a mdraid 1.2 Linux software RAID1.
– my root partition is an ext4 partition in a logical volume group (lvm) over a mdraid 1.2 Linux software RAID1.

STEP 1: Load the missing modules


grub> mdraid1x
grub> insmod lvm
grub> lsmod

STEP 2: List the disks seen by grub


grub>ls

If you are licky you will be able to identify your root and boot partition. In my case boot is seen as (md/0) and root as (lvm/fedora_localhost-root)

STEP 3: Load the grub configuration and boot the easy way
First I try to load the grub.conf file from the boot partition and hope for the best. If successful you end up seeing the grub menu and after choosing an option boot successfully.


grub> configfile (md/0)/grub2/grub.cfg

STEP 4: Load the grub configuration and boot the hard way
In case STEP 3 is a failure repeat STEP 1-2 and then do the following.

Set the root in grub:


grub> set root=(lvm/fedora_localhost-root)

Load the kernel.


grub> linux16 (md/0)/vmlinuz-4.3.5-300.fc23.x86_64 root=/dev/mapper/fedora_localhost-root ro rd.lvm.lv=fedora_localhost/root rd.auto rd.md.waitclean=1

where:
– rd.lvm.lv=fedora_localhost/root : forces the initialization of the root lvm disk
– rd.auto rd.md.waitclean=1 : forces the init of raid and forces grub to wait until all raid partitions are initialized and reconstructed

Load the ram disk of the kernel.


grub> initrd16 (md/0)/initramfs-4.3.5.img

Boot:


grub> boot

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.