广告

本站里的文章大部分经过自行整理与测试

2017年3月24日星期五

Linux - grub-rescue 用法

grub-rescue> ls
会列出所有分区..

例子:
grub-rescue> ls (hd0,msdos2)
(hd0,msdos2): Filesystem is ext4.

先找出 Linux 分区.. grub 文件夹里会有 grub.cfg

# /boot 非单独分区
grub-rescue> ls (hd0,msdosX)/boot/grub
grub-rescue> set root=(hd0,msdosX)
grub-rescue> set prefix=(hd0,msdosX)/boot/grub
grub-rescue> insmod normal
grub-rescue> normal
grub-rescue> linux /boot/vmlinuz-4.8.0-41-generic root=/dev/sdaX
grub-rescue> initrd /boot/initrd.img-4.8.0-41-generic

grub-rescue> boot

# /boot 单独分区
grub-rescue> ls (hd0,msdosX)/grub
grub-rescue> set root=(hd0,msdosX)
grub-rescue> set prefix=(hd0,msdosX)/grub
grub-rescue> insmod normal
grub-rescue> normal
grub-rescue> linux /grub/boot/vmlinuz-4.8.0-41-generic root=/dev/sdaX
grub-rescue> initrd /grub/boot/initrd.img-4.8.0-41-generic

grub-rescue> boot

进入 Linux 如 Ubuntu 后..

# 更新 grub 2
$ su

# Ubuntu
$ update-grub
$ grub-install /dev/sda

# Fedora
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
$ grub2-install /dev/sda

没有评论:

发表评论