[Linux] Rocky Linux 9.5 LVM 구성 디스크 초기화 절차 (PV/VG/LV/Partiton 제거)






1. 개요

  • LVM 환경에서 캐시 LV까지 포함된 볼륨 그룹(VG) 을 깨끗하게 삭제하는 과정을 다룹니다.
  • umount → lvremove → vgremove → pvremove → parted 순으로 진행하며, 최종적으로 디스크를 원래의 깨끗한 상태로 복원합니다.



2. 버전

  • Rocky Linux 9.5



3. 마운트




3-1. 마운트 확인

# df -Th  /mnt/ext4/


출력 예시:

Filesystem                  Type  Size  Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_ext4 ext4  126G  101G   20G  85% /mnt/ext4



3-2. 마운트 해제

# umount /mnt/ext4/


3-3. 마운트 해제 확인

# df -Th | grep ext4



4. LV(Logical Volume)




4-1. LV(Logical Volume) 확인

# lvdisplay


출력 예시:

  --- Logical volume ---
  LV Path                /dev/vg_test/lv_ext4
  LV Name                lv_ext4
  VG Name                vg_test
  LV UUID                L1PRL8-c8Rn-zOWE-xAWq-xPL4-Ymbj-wDPhKV
  LV Write Access        read/write
  LV Creation host, time KVM01, 2025-09-07 12:32:46 +0900
  LV Cache pool name     cachepool_cpool
  LV Cache origin name   lv_ext4_corig
  LV Status              available
  # open                 0
  LV Size                <128.00 GiB
  Cache used blocks      92.71%
  Cache metadata blocks  24.03%
  Cache dirty blocks     9.65%
  Cache read hits/misses 141 / 259
  Cache wrt hits/misses  265997 / 428977
  Cache demotions        0
  Cache promotions       8
  Current LE             32767
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     512
  Block device           252:3



4-2. LV(Logical Volume) 제거

# lvremove -y vg_test


출력 예시:

  Logical volume "lv_ext4" successfully removed.



4-3. LV(Logical Volume) 제거 확인

# lvdisplay



5. VG(Volume Group)




5-1. VG(Volume Group) 확인

# vgdisplay


출력 예시:

  --- Volume group ---
  VG Name               vg_test
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               255.99 GiB
  PE Size               4.00 MiB
  Total PE              65534
  Alloc PE / Size       0 / 0
  Free  PE / Size       65534 / 255.99 GiB
  VG UUID               rBLR4Q-ztPJ-VDnm-0SvL-Fhko-Hf20-P98usi



5-2. VG(Volume Group) 삭제

# vgremove -y vg_test


출력 예시:

  Volume group "vg_test" successfully removed



5-3. VG(Volume Group) 삭제 확인

# vgdisplay



6. PV(Physical Volume)




6-1. PV(Physical Volume) 확인

# pvdisplay


출력 예시:

  "/dev/vdb1" is a new physical volume of "<128.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/vdb1
  VG Name
  PV Size               <128.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               nQSzN2-JP5C-lRXm-k0ns-cRu3-uLgh-CAuLGl

  "/dev/vdc1" is a new physical volume of "<128.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/vdc1
  VG Name
  PV Size               <128.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               MP1dNy-nYQV-zB49-bL5t-c3TA-3jjH-gKdeAs



6-2. PV(Physical Volume) 제거

# pvremove -y /dev/vdb1 /dev/vdc1


출력 예시:

  Labels on physical volume "/dev/vdb1" successfully wiped.
  Labels on physical volume "/dev/vdc1" successfully wiped.



6-3. PV(Physical Volume) 제거 확인

# pvdisplay



7. Partition




7-1. Partition 확인

# parted -l


출력 예시:

Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 137GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  137GB  137GB               vdb   lvm

Model: Virtio Block Device (virtblk)
Disk /dev/vdc: 137GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  137GB  137GB               vdc   lvm



7-2. Partition 제거

# parted -s /dev/vdb rm 1
# parted -s /dev/vdc rm 1



7-3. Partition 제거 확인

# parted -l


출력 예시:

Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 137GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags

Model: Virtio Block Device (virtblk)
Disk /dev/vdc: 137GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags



댓글 남기기