fedora 下 修复grub2 引导 使用livecd
系统原 是先win7 后 fedora .然后win7出问题又安装win7 grub2 菜单不见了 例子是 mbr grub2 被破坏了
以下为修复过程
系统 windows7 + fedora19 分区若干
[root@localhost liveuser]# fdisk -l
Disk /dev/sda: 69.8 GB, 69793218560 bytes, 136314880 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xfdcd0a7c
Device Boot Start End Blocks Id System
/dev/sda1 * 63 32772599 16386268+ 7 HPFS/NTFS/exFAT
/dev/sda2 32772600 136311524 51769462+ f W95 Ext'd (LBA)
/dev/sda5 32772663 57352049 12289693+ 7 HPFS/NTFS/exFAT
/dev/sda6 57354240 58378239 512000 83 Linux
/dev/sda7 58380288 136310783 38965248 8e Linux LVM
Disk /dev/mapper/live-rw: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/live-osimg-min: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/fedora-root: 37.7 GB, 37731958784 bytes, 73695232 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/fedora-swap: 2164 MB, 2164260864 bytes, 4227072 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
/dev/sda6 是 /boot
/dev/mapper/fedora-root 是 /
mount /dev/mapper/fedora-root /mnt/
mount /dev/sda6 /mnt/boot
mount --bind /dev /mnt/dev
chroot /mnt
grub2-install /dev/sda
grub2-install --recheck /dev/sda
多硬盘 执行下
grub2-mkconfig -o /boot/grub2/grub.cfg
重启后可以进入 fedora 也可一进入 win7 (提示错误 但是能进入,消除这个错误方法:进入fedora 进入终端 su grub2-mkconfig -o /boot/grub2/grub.cfg .<这里还需要再检验下 fedora 下就得 yong grub2>再次启动后进入win7菜单 就没有这个错误提示了 )
修改这个位置改变启动顺序
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="${saved_entry}" 引号内改为2默认启动就是win7了
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
阅读(15598) | 评论(0) | 转发(0) |