grub은 항상 grub 명령줄로 부팅됩니다.

grub은 항상 grub 명령줄로 부팅됩니다.

원격 CentOS 6.4 서버(KVM 액세스 포함)가 있는데, 서버를 받았을 때 단일 디스크(sda)에서 LVM으로 실행 중이었습니다.

LVM을 제거하고 sda 및 sdb 디스크에 raid 1을 설치했습니다.

미러링은 잘 작동합니다. 이제 유일한 문제는 서버를 재부팅할 때마다 grub 명령줄이 표시되고 명령을 사용하여 수동으로 부팅한다는 것입니다.

grub> 구성 파일 (hd1,0)/grub/grub.conf

또는

grub> 구성 파일 (hd0,0)/grub/grub.conf

그러면 오류 없이 잘 부팅됩니다.

자동 부팅을 어떻게 할 수 있는지 아시나요?

참고: 각 디스크(sda 및 sdb)의 크기는 2TB입니다. 이것이 문제가 될 수 있습니까?

내 설정

Filesystem            Size  Used Avail Use% Mounted on
/dev/md2              1.8T  1.1G  1.7T   1% /
tmpfs                  16G     0   16G   0% /dev/shm
/dev/md0              1.9G   69M  1.8G   4% /boot


 # cat /proc/mdstat 

 Personalities : [raid1] 
 md2 : active raid1 sda3[2] sdb3[0]
        1940882240 blocks super 1.2 [2/2] [UU]

 md1 : active raid1 sdb2[0] sda2[2]
       10482176 blocks super 1.2 [2/2] [UU]

 md0 : active raid1 sdb1[0] sda1[1]
       2008000 blocks [2/2] [UU]

  unused devices: <none>

# fdisk -l /dev/sda

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b0530

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         250     2008093+  83  Linux
/dev/sda2             251        1556    10490445   82  Linux swap / Solaris
/dev/sda3            1557      243201  1941013462+  fd  Linux raid autodetect


# fdisk -l /dev/sdb

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xadb3bd62

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         250     2008093+  fd  Linux raid autodetect
/dev/sdb2             251        1556    10490445   82  Linux swap / Solaris
/dev/sdb3            1557      243201  1941013462+  fd  Linux raid autodetect

# cat grub.conf 


# 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 (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_srv6953-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd1,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-358.18.1.el6.x86_64)
    root (hd1,0)
    kernel /vmlinuz-2.6.32-358.18.1.el6.x86_64 ro root=/dev/md2 KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 crashkernel=auto rhgb quiet rd_retry=20
    initrd /initramfs-2.6.32-358.18.1.el6.x86_64.img
title CentOS (2.6.32-358.el6.x86_64)
    root (hd1,0)
    kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/md2  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 crashkernel=auto rhgb quiet
    initrd /initramfs-2.6.32-358.el6.x86_64.img



# 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,0)
root (hd0,0)
 Filesystem type is ext2fs, partition type 0xfd
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)"...  27 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+27 p (hd0,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.

답변1

서버 하드 디스크 장치에 grub을 다시 설치해야 합니다. 장치 주소를 알려면 터미널을 입력하세요.

  sudo fdisk -l

그러면 디스크와 해당 볼륨이 목록에 나열됩니다. grub을 설치해야 하는 장치를 기록해 두십시오. 장치의 크기가 힌트를 줄 것입니다. /dev/sda가 grub을 설치해야 하는 장치인 경우 터미널로 이동하여 다음을 입력하세요.

 sudo grub-install /dev/sda

서버를 재부팅하고 문제가 해결되었는지 확인하세요.

답변2

좋아요

나는 다음을 수행했습니다.

  1. raid에서 sda 제거(mdadm 사용)
  2. dd 실행(dd if=/dev/zero of=/dev/sda bs=512 count=1000)
  3. 현재 디스크 파티션 테이블을 복사합니다(sfdisk -d /dev/sdb | sfdisk /dev/sda)
  4. RAID에 디스크 추가(mdadm 사용)
  5. grub 재설치 (grub 명령 사용)
  6. grub-install /dev/sda 실행
  7. 재부팅

이제 작동 중입니다 :)

2단계를 제외하고 이전에 위의 모든 단계를 수행했는데, dd로 디스크를 지워야 할 것 같습니다.

관련 정보