四 进入boot目录,删除所有的文件,在不断开连接的情况下恢复
[root@serv01 ~]# cd /boot
[root@serv01 boot]# ls
config-2.6.32-131.0.15.el6.x86_64 initramfs-2.6.32-131.0.15.el6.x86_64.img System.map-2.6.32-131.0.15.el6.x86_64
efi lost+found vmlinuz-2.6.32-131.0.15.el6.x86_64
grub symvers-2.6.32-131.0.15.el6.x86_64.gz
[root@serv01 boot]# rm -rf *
[root@serv01 boot]# ll
total 0
#第一步,安装grub
[root@serv01 boot]# grub-install /dev/sda
Probing devices to guess BIOS drives. Thismay take a long time.
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any ofthe lines is incorrect,
fix it and re-run the script`grub-install'.
(fd0) /dev/fd0
(hd0) /dev/sda
#第二步,安装kernel
[root@serv01 boot]# yum reinstall kernel -y
Loaded plugins: product-id, subscription-manager
Updating Red Hat repositories.
Setting up Reinstall Process
rhel-iso | 4.0 kB 00:00 ...
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_640:2.6.32-131.0.15.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================
Reinstalling:
kernel x86_64 2.6.32-131.0.15.el6 rhel-iso 23 M
Transaction Summary
======================================================================================================================================
Reinstall 1 Package(s)
Total download size: 23 M
Installed size: 108 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing :kernel-2.6.32-131.0.15.el6.x86_64 1/1
duration: 263(ms)
Installed products updated.
Installed:
kernel.x86_64 0:2.6.32-131.0.15.el6
Complete!
[root@serv01 boot]# ls
config-2.6.32-131.0.15.el6.x86_64 initramfs-2.6.32-131.0.15.el6.x86_64.img System.map-2.6.32-131.0.15.el6.x86_64
grub symvers-2.6.32-131.0.15.el6.x86_64.gz vmlinuz-2.6.32-131.0.15.el6.x86_64
#进入grub目录,然后新建grub.conf文件
[root@serv01 boot]# cd grub/
[root@serv01 grub]# ll
total 268
-rw-r--r--. 1 root root 30 Jul 31 00:44 device.map
-rw-r--r--. 1 root root 13396 Jul 31 00:44 e2fs_stage1_5
-rw-r--r--. 1 root root 12620 Jul 31 00:44 fat_stage1_5
-rw-r--r--. 1 root root 11764 Jul 31 00:44 ffs_stage1_5
-rw-r--r--. 1 root root 11772 Jul 31 00:44 iso9660_stage1_5
-rw-r--r--. 1 root root 13300 Jul 31 00:44 jfs_stage1_5
-rw-r--r--. 1 root root 11956 Jul 31 00:44 minix_stage1_5
-rw-r--r--. 1 root root 14444 Jul 31 00:44 reiserfs_stage1_5
-rw-r--r--. 1 root root 512 Jul 31 00:44 stage1
-rw-r--r--. 1 root root 126040 Jul 31 00:44stage2
-rw-r--r--. 1 root root 12040 Jul 31 00:44 ufs2_stage1_5
-rw-r--r--. 1 root root 11396 Jul 31 00:44 vstafs_stage1_5
-rw-r--r--. 1 root root 13980 Jul 31 00:44 xfs_stage1_5
[root@serv01 grub]# vim grub.conf
#文件内容如下
[root@serv01 grub]# cat grub.conf
default=0
timeout=5
title RedHat Server 6.1
root(hd0,0)
kernel/vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=/dev/sda2 quiet
initrd/initramfs-2.6.32-131.0.15.el6.x86_64.img
[root@serv01 grub]# reboot
Broadcast message from root@serv01.host.com
(/dev/pts/0)at 0:47 ...
The system is going down for reboot NOW!
[root@serv01 grub]# Connection to192.168.1.11 closed by remote host.
Connection to 192.168.1.11 closed.
#重启后然后重新连接,成功,OK!
[root@larrywen Desktop]# ssh 192.168.1.11
root@192.168.1.11's password:
Last login: Wed Jul 31 00:43:50 2013 from192.168.1.1
[root@serv01 ~]#
