Grub 引导修复
2015-08-06 13:20
393 查看
Introduction
GNU GRUB (short for GNU GRand Unified Bootloader) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Free Software Foundation's Multiboot Specification, which provides a user the choice to boot one of multiple operatingsystems installed on a computer or select a specific kernel configuration available on a particular operating system's partitions.
Purpose
Provide a background about GRUB, and a guide of how to fix problems.
Requirements
Skills
Basic Grub knowledge.
Common GRUB problems
Disk is broken.Lost /boot/grub/grub.conf or /boot/grub2/grub.cfg.
grub.conf and grub.cfg code change.
edit]Tools
GNU GRUB 0.97 and GNU GRUB 2
TIPs
Every Linux system Grub is different, so we must confirm the type of operating system.Every Grub version has different fix steps, this wiki just tell you how to fix Grub 0.97 and Grub2.
WARNING
Operation may cause the machine or the host machine kernel panic or CPU stop running.
Summary
Confirm Grub version.Find fix way.
Rebuild grub.conf
Procedure
Determine Grub versionYou can find Grub title like this:
GNU GRUB version 0.97
You can find Grub2 title like this:
GNU GRUB version 2.02
caution
Sometimes you can’t find version, you can type in “help”command. If you find so many commands this Grub is Grub 2, if you find have a little commands this Grub is Grub 0.97.
How to fix
CentOS 5.5
Confirm /boot locationuse "find" command, you can confirm /boot location.(this step is very important) you can find have a disk is /boot (type is 0x83)
find (hd0,<button tab>)
If disk is broken, you cannot find any disk description.
Partition num: 0, Filesystem type unknown, partition type 0x8e
set root
root (hd0,0) (if system /boot is on the hd0,0)
make a link /root
kernel /vmlinuz-******** ro root=/dev/VolGroup00/LogVol[number] ( Useful Remember this path in the future) initrd /initrd-********.img boot
if you can’t find LogVol[number] you can find form this path(but isn’t right path just can help you to find simple path, you need try this file name ). YOU CAN FIND THIS INFORMATIONTrying to resume from /dev/VolGroup00/LogVol[number]
rebuild grub.conf
If successfully entry system, you can find /boot/grub/ have a link (menu.lst->grub.conf), this is temporary, if you reboot the system will return to Grub mode, so you need to rebuild the grub.conf file.
CentOS 5.5 grub.conf template:
default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-194.el5) root (hd0,0) kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol[number] rhgb quiet initrd /initrd-2.6.18-194.el5.img
CentOS 6.5
find where is /bootuse "find" command, you can confirm /boot location.(this step is very important) you can find have a disk is /boot (type is 0x83)
find (hd0,<button tab>)
If disk is broken, you cannot find any disk description.
Partition num: 0, Filesystem type unknown, partition type 0x8e
set root
root (hd0,0) (if system /boot is on the hd0,0)
make a link /root
kernel /vmlinuz-******** ro root=/dev/mapper/vg_[hostname]-lv_root ( Useful Remember this path in the future) initrd /initramfs-********.img boot
if you can’t find vg_[hostname]-lv_root you can find form this path(this is just a piece of file name you need make this file name full ) YOU CAN FIND THIS INFORMATION dracut:Found volume group "vg_[hostname]" using metadata type lvm2
rebuild grub.conf
If successfully entry system, you can find /boot/grub/ have a link (menu.lst->grub.conf), this is temporary, if you reboot the system will return to Grub mode, so you need to rebuild the grub.conf file. CentOS 6.5 grub.conf template:
default=0 timeout=5 hiddenmenu title CentOS (2.6.32-431.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/vg_[hostname]-lv_root initrd /initramfs-2.6.32-431.el6.x86_64.img
reboot and test
reboot system to test grub.conf.
CentOS 7.0
CentOS differs from CentOS 5.5 and CentOS 6.5, because CentOS 7.0 used Grub2 and you can find Grub title version. so you need use "help" to confirm Grub version. Grub2 fix way is very simple.ls (hd0,<button tab>)
If disk is broken, you cannot find any disk description,like this:
Partition num: 0, Filesystem type unknown, partition type 0x8e
insert disk mode
insmod xfs
set /root
set root=(hd0,msdos1) (if system /boot is on the hd0,msdos1)
make a link
linux16 /vmlinuz-xxxxx root=/dev/mapper/centos-root initrd16 /initramfs-.xxxxx.img boot
rebuild grub.cfg
Open a terminal and type this command you can rebuild grub.cfg
grub2-mkconfig >/boot/grub2/grub.cfg
相关文章推荐
- POI合并单元格
- iOS_导航栏的navigationBar.hidden与navigationBarHidden的区别
- vim菜单栏修改成英文的方法
- Holding Bin-Laden Captive!
- Sprite 3D用法和相关特性详解(包括如何从零到一个完整工程)
- vim基本命令
- 创建一个没有父节点的分支
- [Usaco2008 Open]Word Power 名字的能量
- Ubuntu下crontab命令的用法
- Tabbar与Navigation嵌套
- MVC dropdownlist自动绑定、验证、默认值
- 人证比对TCPSERVER
- LeetCode手记-Add Binary
- 整理 Anglarjs的service,directve的基本用法
- 单元测试覆盖率生成网页报告----(五)邮件通知
- 使用CSS3画出一个叮当猫
- 支付宝条码支付
- MongoVUE怎样插入数据
- Divide Groups
- java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy