Rocky9

[Linux] Rocky Linux 9.5 LVM 스냅샷 실습 ext4/XFS 스냅샷 생성·변경·병합(롤백) 가이드[Linux] Rocky Linux 9.5 LVM 스냅샷 실습 ext4/XFS 스냅샷 생성·변경·병합(롤백) 가이드






1. 개요

  • 본 글은 LVM의 스냅샷(snapshot) 기능으로 복구 지점 생성 → 파일 변경 → 스냅샷 병합(rollback) 과정을 실습합니다.
  • 동일한 절차를 ext4XFS에 각각 적용해 병합 후 원복 결과까지 확인합니다.



2. 버전

  • Rocky Linux 9.5



3. 설명




3-1. LVM 스냅샷 개념

  • Origin(원본 LV)의 시점 복사본을 Copy-on-Write(COW)로 보관하는 방식입니다.
  • 스냅샷 생성 후 원본에 변경이 생기면, 변경 전 블록이 스냅샷에 저장됩니다.
  • lvconvert --merge로 스냅샷을 병합하면 원본이 스냅샷 시점으로 되돌아갑니다.

참고: 스냅샷 용량(-L)은 “변경되는 데이터량”을 담을 만큼 필요합니다. 부족해 overflow가 나면 스냅샷이 무효가 됩니다.



4. 스냅샷




4-1. 스냅샷 생성

# lvcreate -s -L 512M -n snap_ext4 /dev/vgtest/lv_ext4


출력 예시:

  Logical volume "snap_ext4" created.


# lvcreate -s -L 512M -n snap_xfs /dev/vgtest/lv_xfs


출력 예시:

  Logical volume "snap_xfs" created.



4-2. 원본 변경

# echo "hello-ext4" > /mnt/ext4/TEST.txt
# echo "hello-xfs" > /mnt/xfs/TEST.txt



4-3. 원본 변경 확인

# cat /mnt/ext4/TEST.txt
# cat /mnt/xfs/TEST.txt



4-4. 마운트 해제

# umount /mnt/ext4 /mnt/xfs



4-5. 스냅샷 병합(롤백)

# lvconvert --merge /dev/vgtest/snap_ext4


출력 예시:

  Merging of volume vgtest/snap_ext4 started.
  vgtest/lv_ext4: Merged: 100.00%


# lvconvert --merge /dev/vgtest/snap_xfs


출력 예시:

  Merging of volume vgtest/snap_xfs started.
  vgtest/lv_xfs: Merged: 100.00%



4-6. 재마운트

# mount /dev/vgtest/lv_ext4 /mnt/ext4
# mount /dev/vgtest/lv_xfs /mnt/xfs



4-7. 확인

# ls -l /mnt/ext4 /mnt/xfs


출력 예시:

/mnt/ext4:
total 16
drwx------. 2 root root 16384 Aug 27 10:21 lost+found

/mnt/xfs:
total 16
drwx------. 2 root root 16384 Aug 27 10:21 lost+found



seuheu

최근 게시물

[Linux] Rocky Linux 9.5 LVM PV/VG/LV 구축, 온라인 확장, ext4 오프라인 축소

https://youtu.be/ZcxB7akkDKs 1. 개요 두 개의 디스크(/dev/vdb, /dev/vdc)로 LVM을 구성하고, ext4·XFS 파일시스템 생성 → 마운트 → VG/LV 확장 → ext4 축소(오프라인)까지 전체…

%일 전

[Linux] Rocky Linux 9.5 Parted로 GPT 파티셔닝: ext4/XFS 포맷과 fstab 자동 마운트

https://youtu.be/XYBR1ZFrV9s 1. 개요 parted를 사용해 새 디스크에 GPT 라벨 생성 → 파티션 생성(ext4/XFS) → 포맷/마운트 →…

%일 전

[Linux] Rocky Linux 9.5 FDISK MBR 파티셔닝 : ext4/XFS 포맷과 fstab 자동 마운트

https://youtu.be/yYV8RQKCFzA 1. 개요 이 문서는 fdisk를 사용해 MBR(DOS) 디스크에 파티션을 생성하고, ext4/XFS 파일시스템을 포맷·마운트, /etc/fstab에 등록했다가, 안전하게 해제·삭제하는 전…

%일 전

[Linux] MBR vs GPT : 리눅스 파티션 방식 쉽게 비교

1. 개요 Linux에서 디스크 파티션 스타일은 MBR(Master Boot Record) 와 GPT(GUID Partition Table)에 대해 설명합니다. 2. MBR이란? 디스크…

%일 전

[WindowsServer] Windows Server 2025 설치

https://youtu.be/CNd1bJV4wGY 1. 개요 Windows Server를 새로 설치할 때의 설치 과정을 단계별로 정리하였습니다. Windows Server 설치…

%일 전

[Linux] Rocky Linux 9.5 KVM Bonding + Bridge 네트워크 구성

https://youtu.be/dVe6vc76yL0 1. 개요 Rocky Linux 9.5 환경에서 두 개의 NIC를 하나로 묶는 Active-Backup Bonding 구성 후, 해당…

%일 전