서버 복구 가이드
    • PDF

    서버 복구 가이드

    • PDF

    Article Summary

    VPC 환경에서 이용 가능합니다.

    1. single mode 진입

    아래와 같은 경우, 싱글 모드에 진입하여 서버 복구를 시도할 수 있습니다.

    • 관리자 암호를 분실한 경우
    • fstab 사용에 문제가 있는 경우
    1. 정상적으로 부팅되지 않는 서버를 선택 후 강제 정지 합니다.
      image.png

    2. 정지된 서버를 시작을 눌러 부팅시킨 후 서버 접속 콘솔에 접근합니다.
      image.png

    1-1. CentOS single mode 진입

    1. 서버 접속 콘솔에 접근 후 커널 버전 선택 화면에서 e를 입력하면 부팅 파라미터 수정 화면으로 진입할 수 있습니다.
      image.png

    2. 아래와 같이 수정 후 Ctrl+x 를 눌러 수정된 부팅 파라미터로 OS를 시작합니다.

    • ro로 되어있는 부분을 rw init=/sysroot/bin/bash 로 수정합니다.
    • rhgb quiet를 삭제합니다.
      image.png
    1. 싱글 모드로 진입합니다.
      image.png

    2. 아래 명령어를 입력하여 서버의 파티션 영역을 마운트 합니다.

    :/# chroot /sysroot
    

    1-2. RHEL single mode 진입

    1. 서버 접속 콘솔에 접근 후 커널 버전 선택 화면에서 e를 입력하면 부팅 파라미터 수정 화면으로 진입할 수 있습니다.
      image.png

    2. 아래와 같이 수정 후 Ctrl+x 를 눌러 수정된 부팅 파라미터로 OS를 시작합니다.

    • ro로 되어있는 부분을 rw init=/sysroot/bin/bash 로 수정합니다.
    • rhgb quiet를 삭제합니다.
      image.png
    1. 싱글 모드로 진입합니다.
      image.png

    2. 아래 명령어를 입력하여 서버의 파티션 영역을 마운트 합니다.

    :/# chroot /sysroot
    

    1-3. Ubuntu single mode 진입

    1. 서버 접속 콘솔에 접근 후 커널 버전 선택 화면에서 e를 입력하면 부팅 파라미터 수정 화면으로 진입할 수 있습니다.
      image.png

    2. 아래와 같이 수정 후 Ctrl+x 를 눌러 수정된 부팅 파라미터로 OS를 시작합니다.

    • ro로 되어있는 부분을 rw single init=/bin/bash 로 수정합니다.
      image.png
    1. 싱글 모드로 진입합니다.
      image.png

    2. 부팅 커널 변경

    2-1. CentOS 부팅 커널 변경

    아래 예시는 부팅 커널을 CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core) 로 변경하는 예시입니다.

    1. 현재 커널 설정 확인
    [root@centos ~]# grub2-editenv list
    saved_entry=CentOS Linux (3.10.0-1127.el7.x86_64) 7 (Core)
    
    1. 커널 리스트 확인
    [root@centos ~]# grep ^menuentry /boot/grub2/grub.cfg | cut -d "'" -f2
    CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core)
    CentOS Linux (3.10.0-1127.el7.x86_64) 7 (Core)
    CentOS Linux (0-rescue-4bfdd392cea14cb58d22427c1c69c5df) 7 (Core)
    
    1. 기본 부팅 커널 설정 변경 후 변경된 커널 설정 확인
    [root@centos ~]# grub2-set-default "CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core)"
    
    [root@centos ~]# grub2-editenv list
    saved_entry=CentOS Linux (3.10.0-1127.19.1.el7.x86_64) 7 (Core)
    
    1. 재부팅 후 커널 확인
    [root@centos ~]# reboot
    
    [root@centos ~]# uname -r
    3.10.0-1127.19.1.el7.x86_64
    

    2-2. RHEL 부팅 커널 변경

    아래 예시는 부팅 커널을 Red Hat Enterprise Linux Server (3.10.0-957.el7.x86_64) 7.6 (Maipo) 로 변경하는 예시입니다.

    1. 현재 커널 설정 확인
    [root@rhel ~]# grub2-editenv list
    saved_entry=Red Hat Enterprise Linux Server (3.10.0-1160.81.1.el7.x86_64) 7.6 (Maipo)
    
    1. 커널 리스트 확인
    [root@rhel ~]# grep ^menuentry /boot/grub2/grub.cfg | cut -d "'" -f2
    Red Hat Enterprise Linux Server (3.10.0-1160.88.1.el7.x86_64) 7.6 (Maipo) 
    Red Hat Enterprise Linux Server (3.10.0-957.el7.x86_64) 7.6 (Maipo)
    Red Hat Enterprise Linux Server (0-rescue-5aae4d1c90d9438093661afa7a4fbe7a) 7.6 (Maipo)
    
    1. 기본 부팅 커널 설정 변경 후 변경된 커널 설정 확인
    [root@rhel ~]# grub2-set-default "Red Hat Enterprise Linux Server (3.10.0-957.el7.x86_64) 7.6 (Maipo)"
    
    [root@rhel ~]# grub2-editenv list
    saved_entry=Red Hat Enterprise Linux Server (3.10.0-957.el7.x86_64) 7.6 (Maipo)
    
    1. 재부팅 후 커널 확인
    [root@rhel ~]# reboot
    
    [root@rhel ~]# uname -r
    3.10.0-957.el7.x86_64
    

    2-3. Ubuntu 부팅 커널 변경

    아래 예시는 부팅 커널을 4.15.0-118-generic 로 변경하는 예시입니다.

    1. 현재 커널 설정 확인
    root@ubuntu:~# cat /etc/default/grub | grep GRUB_DEFAULT
    GRUB_DEFAULT=0
    
    1. 커널 리스트 확인
    root@ubuntu:~# awk -F"--class" '/menuentry/ && /with Linux/ {print $1}' /boot/grub/grub.cfg | awk '{print i++ " : " $5,$6,$7,$8}' | sed -e "s/'/ /g"
    0 : 4.15.0-118-generic    
    1 : 4.15.0-118-generic (recovery mode)  
    2 : 4.15.0-76-generic    
    3 : 4.15.0-76-generic (recovery mode)
    
    1. 기본 부팅 커널 설정 변경 후 변경된 커널 설정 확인
    root@ubuntu:~# vi /etc/default/grub
    
    root@ubuntu:~# grub-set-default 0
    Searching for GRUB installation directory ... found: /boot/grub
    
    root@ubuntu:~# grub-editenv list
    saved_entry=0
    
    root@ubuntu:~# update-grub
    Sourcing file `/etc/default/grub'
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-4.15.0-118-generic
    Found initrd image: /boot/initrd.img-4.15.0-118-generic
    Found linux image: /boot/vmlinuz-4.15.0-76-generic
    Found initrd image: /boot/initrd.img-4.15.0-76-generic
    Found linux image: /boot/vmlinuz-4.15.0-22-generic
    Found initrd image: /boot/initrd.img-4.15.0-22-generic
    done
    
    1. 재부팅 후 커널 확인
    root@ubuntu:~# reboot
    
    root@ubuntu:~# uname -r
    4.15.0-118-generic
    

    3. 서버 복구 불가시 스냅샷을 통한 데이터 복구 방법

    생성된 스냅샷을 사용하여 원하는 서버에 새로운 스토리지를 생성하면 저장된 데이터가 복구됩니다.
    서버가 부팅이 되지 않아 더 이상 사용할 수 없다면 스냅샷을 통해 데이터 복구를 진행해야 합니다.

    3-1. 스냅샷 생성

    1. 스냅샷을 생성하는 방법은 Snapshot 생성 가이드를 참고하십시오.

    3-2. 스냅샷을 통한 데이터 복구

    1. 스냅샷을 사용하여 생성된 스토리지를 서버에 mount 하는 방법은 Snapshot 을 이용한 Block storage 생성 가이드를 참고하십시오.
    주의
    • 스냅샷으로부터 스토리지의 데이터를 읽어와 복구하므로 디스크 파티션, 스토리지 포맷 작업은 생략해 주십시오.
    • 다른 서버의 부팅용 기본 스토리지에서 스냅샷을 생성했거나 스토리지를 추가한 서버의 기존 스토리지 중 하나에서 스냅샷을 생성한 경우, 원본 서버의 스토리지와 생성한 스토리지의 식별자가 중복되어 마운트를 수행할 수 없습니다.
    1. 스토리지를 mount한 경로에 접근하여 데이터 복구를 진행하십시오.

    이 문서가 도움이 되었습니까?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.