[RedHat] Host OS KVM Virtual Machine 스냅샷 관리

스냅샷 이란

스냅샷은 가상 머신의 현재 상태를 저장해 두고 필요할 때 저장해 두었던 시점으로 그대로 복원할 수 있는 기술을 말합니다. 보안 취약점 조치나 업데이트 같은 시스템에 많은 변경이 발생하는 작업 전에 스냅샷을 이용해 현재 상태를 캡처해 두면 복구에 유용하게 사용할 수 있습니다.

KVM에도 스냅샷 기능이 제공되고 있으며 사용 방법에 대해 명령어 위주로 간단하게 알아보도록 하겠습니다.

스냅샷 생성

RHEL8 KVM host의 경우 실행 중인 VM 대상으로 스냅샷 지원이 되지 않습니다.

  1. 스냅샷 대상 도메인 확인 (꺼져 있는 상태에서 진행)
# virsh list --all | grep rhel
 -   rhel9.2                             shut off
# virsh dumpxml rhel9.2 | grep -i qemu
<emulator>/usr/libexec/qemu-kvm</emulator>
<driver name='qemu' type='qcow2'/>
<driver name='qemu' type='raw'/>
  1. snapshot 생성
# virsh snapshot-create-as --domain rhel9.2 --name "rhel9.2-default" --descrsnapshosnapshottiption "default rhel92 image"
Domain snapshot rhel9.2-default created
  1. 생성된 snapshot 확인
# virsh snapshot-list --domain rhel9.2
 Name                   Creation Time               State
-------------------------------------------------------------
 rhel9.2-default   2024-01-10 17:24:04 +0900   shutoff

복원

위에서 생성한 스냅샷 “rhel9.2-default”을 이용하여 스냅샷을 생성한 시점으로 복원이 가능합니다.

  1. VM Shutdown
# virsh shutdown --domain rhel9.2
  1. snapshot 대상 확인
# virsh snapshot-list --domain rhel9.2
 Name                   Creation Time               State
-------------------------------------------------------------
 rhel9.2-default   2024-01-10 17:24:04 +0900   shutoff
  1. 복원
# virsh snapshot-revert --domain rhel9.2 --snapshotname rhel9.2-default
  1. 복원한 가상머신 시작
# virsh start --domain rhel9.2

스냅샷 제거

  1. snapshot 확인
# virsh snapshot-list --domain rhel9.2
 Name                   Creation Time               State
-------------------------------------------------------------
 rhel9.2-default   2024-01-10 17:24:04 +0900   shutoff
  1. snapshot 제거
# virsh snapshot-delete rhel9.2 rhel9.2-default
Domain snapshot rhel9.2-default deleted

마치며

KVM은 레드햇에 포함된 무료 오픈소스 소프트웨어입니다. 이 글에서 KVM의 핵심 기능 중 하나인 스냅샷의 생성 및 복원 방법에 대해 예제를 보면서 자세히 살펴보았습니다.

 

참조

https://www.cyberciti.biz/faq/how-to-create-create-snapshot-in-linux-kvm-vmdomain/

https://www.redhat.com/ko/topics/virtualization/what-is-KVM

댓글 달기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

Scroll to Top