GRUB를 재활성화하고 구성을 변경하는 방법

일반적으로 해당 절차는 부트 로더 매뉴얼 페이지를 참조해야 합니다. 또한 Acronis 웹 사이트에 해당하는 지식 기반 기사도 있습니다.

다음은 시스템 디스크(볼륨)가 동일한 하드웨어로 복구될 때 GRUB를 재활성화하는 방법의 예입니다.

  1. Linux를 시작하거나 부트 가능한 미디어에서 부팅한 다음 CTRL+ALT+F2를 누릅니다.
  2. 복구 중인 시스템 마운트:

    mkdir /mnt/system/
    mount -t ext3 /dev/sda2 /mnt/system/ # root partition
    mount -t ext3 /dev/sda1 /mnt/system/boot/ # boot partition

  3. procdev 파일 시스템을 복구 중인 시스템에 마운트:

    mount -t proc none /mnt/system/proc/
    mount -o bind /dev/ /mnt/system/dev/

  4. 다음 명령 중 하나를 실행하여 GRUB 메뉴 파일의 사본을 저장합니다.

    cp /mnt/system/boot/grub/menu.lst /mnt/system/boot/grub/menu.lst.backup

    또는

    cp /mnt/system/boot/grub/grub.conf /mnt/system/boot/grub/grub.conf.backup

  5. /mnt/system/boot/grub/menu.lst 파일(Debian, Ubuntu 및 SUSE Linux 배포의 경우) 또는 /mnt/system/boot/grub/grub.conf 파일(Fedora 및 Red Hat Enterprise Linux 배포의 경우)을 다음과 같이 편집합니다.

    vi /mnt/system/boot/grub/menu.lst

  6. menu.lst 파일(각각 grub.conf)에서 복구 중인 시스템에 해당하는 메뉴 항목을 찾습니다. 이 메뉴 항목에는 다음 양식이 있습니다.

    title Red Hat Enterprise Linux Server (2.6.24.4)
    root (hd0,0)
    kernel /vmlinuz-2.6.24.4 ro root=/dev/sda2 rhgb quiet
    initrd /initrd-2.6.24.4.img

    title, root, kernelinitrd로 시작하는 행은 각각 다음을 판별합니다.

  7. 복구의 결과로 변경된 장치의 이름을 수정하려면 /mnt/system/etc/fstab 파일을 편집합니다.
  8. 다음 명령 중 하나를 실행하여 GRUB 쉘을 시작합니다.

    chroot /mnt/system/ /sbin/grub

    또는

    chroot /mnt/system/ /usr/sbin/grub

  9. GRUB가 있는 디스크를 지정합니다. 일반적으로 부트 또는 루트 파티션:

    root (hd0,0)

  10. GRUB를 설치합니다. 예를 들어 GRUB를 첫 번째 디스크의 마스터 부트 레코드(MBR)에 설치하려면 다음 명령을 실행하십시오.

    setup (hd0)

  11. GRUB 쉘을 종료함:

    quit

  12. 마운트된 파일 시스템을 마운트 해제한 다음 재부팅함:

    umount /mnt/system/dev/
    umount /mnt/system/proc/
    umount /mnt/system/boot/
    umount /mnt/system/
    reboot

  13. 사용 중인 Linux 배포의 도구와 문서를 사용하여 부트로더를 재구성합니다. 예를 들어, Debian 및 Ubuntu에서는 /boot/grub/menu.lst 파일에서 주석 처리된 몇몇 행을 편집한 다음 update-grub 스크립트를 편집해야 할 수도 있습니다. 그렇지 않으면 변경 사항이 적용되지 않을 수도 있습니다.