linux改引导时间fedora,fedora 下 修复grub2 引导

本文介绍了在Fedora和Windows7双系统环境下,由于MBR中的GRUB2被破坏导致无法正常启动的问题及解决方法。通过使用Fedora LiveCD系统,修复GRUB2引导,重新安装GRUB2并更新配置文件,最终实现能够顺利进入Fedora和Windows7。
摘要由CSDN通过智能技术生成

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  .再次启动后进入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

阅读(14868) | 评论(0) | 转发(0) |

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值