我的远程服务器(运行 CentOS 6.6 x64)无法再启动。
使用紧急恢复(LIVE CD),我实际上可以看到/etc/boot/grub/grub.conf
并且它是空的(0 字节)。我不知道为什么,可能是随机数据丢失或系统更新。
有没有办法grub.conf
从 Live CD 重建?服务器配置了 RAID1,我不太清楚如何处理。
以下是所有可用的内核/boot
:
-rw-r--r-- 1 root root 105200 Jul 31 13:46 config-2.6.32-431.23.3.el6.x86_64
-rw-r--r-- 1 root root 105200 Sep 9 18:02 config-2.6.32-431.29.2.el6.x86_64
-rw-r--r-- 1 root root 105195 Nov 21 2013 config-2.6.32-431.el6.x86_64
-rw-r--r-- 1 root root 106312 Nov 11 13:25 config-2.6.32-504.1.3.el6.x86_64
-rw-r--r-- 1 root root 106308 Oct 15 00:54 config-2.6.32-504.el6.x86_64
drwxr-xr-x 3 root root 4096 Aug 31 12:03 efi
drwxr-xr-x 2 root root 4096 Dec 14 18:36 grub
-rw------- 1 root root 14210073 Aug 31 12:06 initramfs-2.6.32-431.23.3.el6.x86_64.img
-rw------- 1 root root 14212715 Oct 4 20:37 initramfs-2.6.32-431.29.2.el6.x86_64.img
-rw------- 1 root root 14206180 Aug 31 12:04 initramfs-2.6.32-431.el6.x86_64.img
-rw------- 1 root root 0 Dec 14 07:22 initramfs-2.6.32-504.1.3.el6.x86_64.img
-rw------- 1 root root 16077612 Nov 1 21:49 initramfs-2.6.32-504.el6.x86_64.img
-rw-r--r-- 1 root root 193925 Jul 31 13:47 symvers-2.6.32-431.23.3.el6.x86_64.gz
-rw-r--r-- 1 root root 193945 Sep 9 18:02 symvers-2.6.32-431.29.2.el6.x86_64.gz
-rw-r--r-- 1 root root 193758 Nov 21 2013 symvers-2.6.32-431.el6.x86_64.gz
-rw-r--r-- 1 root root 200191 Nov 11 13:26 symvers-2.6.32-504.1.3.el6.x86_64.gz
-rw-r--r-- 1 root root 200191 Oct 15 00:55 symvers-2.6.32-504.el6.x86_64.gz
-rw-r--r-- 1 root root 2519815 Jul 31 13:46 System.map-2.6.32-431.23.3.el6.x86_64
-rw-r--r-- 1 root root 2519815 Sep 9 18:02 System.map-2.6.32-431.29.2.el6.x86_64
-rw-r--r-- 1 root root 2518236 Nov 21 2013 System.map-2.6.32-431.el6.x86_64
-rw-r--r-- 1 root root 2544748 Nov 11 13:25 System.map-2.6.32-504.1.3.el6.x86_64
-rw-r--r-- 1 root root 2544748 Oct 15 00:54 System.map-2.6.32-504.el6.x86_64
-rwxr-xr-x 1 root root 4133040 Jul 31 13:46 vmlinuz-2.6.32-431.23.3.el6.x86_64
-rwxr-xr-x 1 root root 4131984 Sep 9 18:02 vmlinuz-2.6.32-431.29.2.el6.x86_64
-rwxr-xr-x 1 root root 4128368 Nov 21 2013 vmlinuz-2.6.32-431.el6.x86_64
-rwxr-xr-x 1 root root 4151408 Nov 11 13:25 vmlinuz-2.6.32-504.1.3.el6.x86_64
-rwxr-xr-x 1 root root 4152336 Oct 15 00:54 vmlinuz-2.6.32-504.el6.x86_64
我尝试使用此grub.conf
文件(从另一台没有 RAID 的服务器复制)进行启动,其中 UUID 实际上是正确的,但失败了:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-504.1.3.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-504.1.3.el6.x86_64 ro root=UUID=8db8fd9d-c853-4b95-b34d-9b8e64996315 rd_NO_LUKS LANG=en_GB.UTF-8 rd_NO_MD KEYTABLE=us SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-2.6.32-504.1.3.el6.x86_64.img
title CentOS 6 (2.6.32-504.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-504.el6.x86_64 ro root=UUID=8db8fd9d-c853-4b95-b34d-9b8e64996315 rd_NO_LUKS LANG=en_GB.UTF-8 rd_NO_MD KEYTABLE=us SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-2.6.32-504.el6.x86_64.img
答案1
您的启动分区包含 efi 文件夹。如果您使用 efi 启动 grub,请不要使用 /etc/boot/grub/grub.conf 文件。所以它是空的。在 efi 文件夹中您有一个 grub 配置。
您还可以从 efi 分区使用 grub2,因此 grub2 具有 grub2-mkconfig 命令来构建配置。