`
gaofen100
  • 浏览: 1188028 次
文章分类
社区版块
存档分类
最新评论

修复fedora core 9系统

 
阅读更多

grub文件坏了,下面是解决办法。


1 插入fedorade 安装盘或修复盘 据说其他的Linux盘也可 没有尝试
2 选LINUX RESCUE模式 然后不论你如何选择 最终会出现sh#
3 输入fdisk -l 查看你的硬盘 记下Windows和Linux的分区
觉得这一步很扯 居然欺骗我 具体情况后表
4 输入grub 进入grub>
grub>root (hdX,Y)这里的X和Y代表是数字。即hd0,0代表第一块硬盘的第一个分区。根据你刚刚在fdisk里看到的内容填写。

我的情况是
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2550 20482843+ 7 HPFS/NTFS
/dev/sda2 2551 16974 115860780 f W95 Ext'd (LBA)
/dev/sda3 16975 19457 19944697+ 8e Linux LVM
/dev/sda5 2551 7649 40957686 7 HPFS/NTFS
/dev/sda6 7650 8955 10490413+ 7 HPFS/NTFS
/dev/sda7 8956 9593 5124703+ 7 HPFS/NTFS
/dev/sda8 9594 16860 58372146 7 HPFS/NTFS
/dev/sda9 16861 16885 200781 83 Linux

因为是sda9为Linux分区 所以要输入root (hd0,8) 显示识别出它是extxxxxx文件格式

5 grub>setup (hdX)此处的X和上一个数值保持一致,成功的话,会提示succeed

然后

grub>quit

sh#reboot
修复完成。

---------------

修复的步骤如下:

1,cd启动盘,fedora8,或者fedora9都可以,甚至其他的有图形界面安装的linux版本都可以的,启动后一直按照安装的步骤进入安装的桌 面,就是桌面上有一个文件夹,还有个计算机,还有个install的图标的桌面,这时候,你从左上角的fedora菜单栏里面,找到系统工具,点击终端。

2,终端里面如何输入请看我的输入。

QUOTE:
[fedora@localhost ~]$ grub
bash: grub: command not found
[fedora@localhost ~]$ whereis grub
grub: /sbin/grub /usr/share/grub /usr/share/man/man8/grub.8.gz
[fedora@localhost ~]$ su
[root@localhost fedora]# /sbin/grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd0,7)
root (hd0,7)
Filesystem type is ext2fs, partition type 0×83
grub> setup (hd0)
setup (hd0)
Checking if “/boot/grub/stage1″ exists… yes
Checking if “/boot/grub/stage2″ exists… yes
Checking if “/boot/grub/e2fs_stage1_5″ exists… yes
Running “embed /boot/grub/e2fs_stage1_5 (hd0)”… 23 sectors are embedded.
succeeded
Running “install /boot/grub/stage1 (hd0) (hd0)1+23 p (hd0,7)/boot/grub/stage2 /boot/grub/grub.conf”… succeeded
Done.
grub>


3,解释如下,su切换到root用户,然后输入 /sbin/grub 来启动grub这样就能开始grub>,然后开始安装grub,输入root (hd0,7),这里面root后面有一个空格不要忘记了,hd后面的数字0,还有那个7要看你自己的情况来定了。0代表的是第几块硬盘,7代表的是第几个分区,你对于这不能很确定的话,可以点击桌面上的install图标,一直到他让你选择分区什么的东西,你可以在那里看看你的fedora是装在第几个分区里面,我的是在第7个分区里面,然后setup (hd0)也有空格的,这个0和前面的0是必须一样的。

---------------

和许多其他linux发行版一样,Fedora使用Grub作为32位和64位X86系统的启动加载器(bootloader)。grub的配置文件主要是/boot/grub /grub.conf,而/boot/grub/menu.list是这个文件的软连接(soft link)。该配置文件样式如下。

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd1,0)
# kernel /vmlinuz-version ro root=/dev/sda7
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.23.1-42.fc8)
root (hd0,0)
kernel /vmlinuz-2.6.23.1-42.fc8 ro root=LABEL=/
initrd /initrd-2.6.23.1-42.fc8.img

title WindowsXP

rootnoverify (hd0,0)
chainloader +1

主要分为三个部分,开始的注释(#开头)不算,依次是通用的选项,Fedora 8的启动选项和Windows系统的启动选项。

通用选项部分

default 表示默认启动的系统,以0开始计数,表示第一,二……

timeout 多少秒之后默认的系统被自动加载,这里是5秒后,用户不做选择的话,Fedora 8 被启动;

hiddenmen 默认隐藏菜单,直到用户按下某个键;

splashimage 起动器显示的背景图像,该图像的格式是一种特殊格式,需要特殊工具制作,然后放置在合适的位置;

Fedora启动章节

root 设置启动系统的分区,这里指定的不是linux系统的根分区(root system),而是boot分区,Grub是系统启动加载器,因而他所谓的root是指系统从那个分区开始启动,对于Linux系统而言是boot分区;

kernel 内核,位于boot分区上的合适内核;

initrd 指定特殊的initrd镜像文件用于启动系统时ramdisk(内存中的虚拟盘技术)加载的对象,一般会在该镜像中包含一些特殊设备的驱动等,如USB驱动的支持,一遍Linux系统可以从UBS设备上正常的启动,该文件可以根据特定的内核和启动介质定制,关于如何定制,可以查看RedHat相关的文档;

Grub启动linux的顺序是从指定的boot分区加载指定的kernel(内核)和initrd镜像,而对于其他系统,处理情况不同,Grub会把任务交由该系统的引导程序(如windows的bootloader)去启动系统;

rootnoverify 指定包含引导器的分区,类似Linux root指令;

chainloader 指定非linux系统的加载程序位于指定分区的+1扇区上,以便其它系统的加载器被正确加载并能执行加载其它系统的任务;

在该文件中,磁盘分区以(hdX,N)描述,X表示磁盘号,以0开始计数,依照BIOS的磁盘顺序指定;N是磁盘分区号,也是从0开始计数;如BIOS顺序第一块磁盘的第二个分区(/dev/sda2), 在Grub中表示为(hd0, 1);

Grub.conf是普通text文件格式的,可以用任何文本编辑器编辑,如VI,gedit或者kate等;需要注意的是,任何编辑错误都将导致系统无法正常加载和启动,需要特别慎重和小心!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics