Blog
HowTos
Kernel
Linux
SysAdmin
]
Sometimes when you upgrade or migrate your linux from one disk to another, boot should hang out on line “grub rescue>“,
what now ?
List available disks
grub rescue>ls
Here you can see something like (hd0,msdos1) (hd0,msdos2). Your physical disk is hd0 and partitions are msdos*.
Now you must find which is root partition.
grub rescue>ls (hd0,msdos1)/ bin cdrom etc initrd.img lib lib64 media opt root sbin srv tmp var vmlinuz.old boot dev home initrd.img.old lib32 lost+found mnt proc run selinux sys usr vmlinuz
Good this is our root partition. Now we must set prefix for grub to be able load modules and set root to be able load kernel.
grub rescue>set prefix=(hd0,msdos1)/boot/grub grub rescue>insmod linux grub rescue>set root=(hd0,msdos1)
Our kernel is located in /vmlinuz and initrd file is /initrd.img (look on ls section)
We load kernel and initrd image and boot system.
grub rescue>linux /vmlinuz root=/dev/sda1 ro grub rescue>inird /initrd.img grub rescue>boot
Done ! Some lines can be different, it depends on your configuration.
If you are using LVM, or Linux MD RAID you must load additional modules to work with this technologies.
I recomend study your /boot/grub/grub.cfg to learn what your system needs.