본문 바로가기
서버/리눅스 서버

Proxmox VG 추가하기 (LVM)

by ㅋㅋ잠자 2021. 3. 27.
반응형

안녕하세요?

 

SSD를 용량 큰걸 주문했으면 좋겠지만, 그렇지 않은 경우가 있습니다. 이전에 PROXMOX 설치할 때, LVM 으로 구성하여 진행했었어서 서브로 있는 128GB를 볼륨 그룹에 추가하고 메인 파티션을 확장하는 방법을 작성해보겠습니다.

 

현재 256기가 SSD가 볼륨 그룹 pve 에 들어있고 그룹 내부에 로직 볼륨이 1개가 있는 상황입니다.

root@debian:~# vgdisplay -v
  --- Volume group ---
  VG Name               pve
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  10
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <344.17 GiB
  PE Size               4.00 MiB
  Total PE              88107
  Alloc PE / Size       59490 / 232.38 GiB
  Free  PE / Size       28617 / <111.79 GiB
  VG UUID               kYfILY-SX8p-46Uz-CBn0-zGHf-5nZ9-J2cQCg

  --- Logical volume ---
  LV Path                /dev/pve/swap
  LV Name                swap
  VG Name                pve
  LV UUID                WlThbd-U6KY-FO7q-O6Z9-RVbe-82Mp-6LVpeP
  LV Write Access        read/write
  LV Creation host, time proxmox, 2021-01-09 07:22:20 +0900
  LV Status              available
  # open                 2
  LV Size                7.00 GiB
  Current LE             1792
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/pve/root
  LV Name                root
  VG Name                pve
  LV UUID                FX16nj-s8zM-trJq-Jks2-anNd-e2pe-Bk57GM
  LV Write Access        read/write
  LV Creation host, time proxmox, 2021-01-09 07:22:21 +0900
  LV Status              available
  # open                 1
  LV Size                225.38 GiB
  Current LE             57698
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Physical volumes ---
  PV Name               /dev/sda3
  PV UUID               kFug0B-jyQR-25cc-AjUp-fucw-uF77-yv0Ifc
  PV Status             allocatable
  Total PE / Free PE    59490 / 0

확인을 해보면 pve 라는 볼륨 그룹에 피지컬 볼륨 /dev/sda3 이 있으며, pve 볼륨 그룹에 swap / root 라는 로직 볼륨이 있는 것입니다.

 

여기에 128GB SSD 를 추가하여 pve 볼륨 그룹에 추가하고 /dev/pve/root 로직 볼륨을 확장해보겠습니다.

# 해당 128기가 디스크 파티션 삭제
root@debian:~# fdisk -l

Disk /dev/sdc: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Disk model: 00SSD1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8a0724a1

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sdc1        32768    557055    524288   256M  e W95 FAT16 (LBA)
/dev/sdc2       557056 234441647 233884592 111.5G 83 Linux


root@debian:~# fdisk /dev/sdc

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1,2, default 2): 1

Partition 1 has been deleted.

Command (m for help): d
Selected partition 2
Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-234441647, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-234441647, default 234441647):

Created a new partition 1 of type 'Linux' and of size 111.8 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

# 파티션 타입 변경
# 8e 가 LVM 용도 입니다.
root@debian:~# fdisk /dev/sdc

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

# LVM 생성
root@debian:~# pvcreate /dev/sdc1
  Physical volume "/dev/sdc1" successfully created.
root@debian:~# vgdisplay
  --- Volume group ---
  VG Name               pve
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               232.38 GiB
  PE Size               4.00 MiB
  Total PE              59490
  Alloc PE / Size       59490 / 232.38 GiB
  Free  PE / Size       0 / 0
  VG UUID               kYfILY-SX8p-46Uz-CBn0-zGHf-5nZ9-J2cQCg

# pve 볼륨 그룹에 추가
# 용량이 55395 / 216.39 GiB 에서 344GB 로 늘었습니다.
root@debian:~# vgextend pve /dev/sdc1
  Volume group "pve" successfully extended
root@debian:~# vgdisplay
  --- Volume group ---
  VG Name               pve
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  10
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <344.17 GiB
  PE Size               4.00 MiB
  Total PE              88107
  Alloc PE / Size       59490 / 232.38 GiB
  Free  PE / Size       28617 / <111.79 GiB
  VG UUID               kYfILY-SX8p-46Uz-CBn0-zGHf-5nZ9-J2cQCg

/dev/pve/root 로직 볼륨을 확장합니다.

# FREE 갯수를 확인하고 직접 기입해줘도 됩니다.
root@debian:~# vgdisplay pve
  --- Volume group ---
  VG Name               pve
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  10
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <344.17 GiB
  PE Size               4.00 MiB
  Total PE              88107
  Alloc PE / Size       59490 / 232.38 GiB
  Free  PE / Size       28617 / <111.79 GiB
  VG UUID               kYfILY-SX8p-46Uz-CBn0-zGHf-5nZ9-J2cQCg

# 그냥 남은 거 다 할당하라고 명령을 줍니다.
root@debian:~# lvextend /dev/pve/root -l +100%FREE
  Size of logical volume pve/root changed from 225.38 GiB (57698 extents) to <337.17 GiB (86315 extents).
  Logical volume pve/root successfully resized.
  
# 확장 전
root@debian:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
udev                  3.7G     0  3.7G   0% /dev
tmpfs                 768M   11M  757M   2% /run
/dev/mapper/pve-root  222G   58G  155G  27% /
tmpfs                 3.8G   46M  3.8G   2% /dev/shm

# resize2fs 로 확장
# 332GB 로 늘었습니다.
root@debian:~# resize2fs /dev/mapper/pve-root
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/mapper/pve-root is mounted on /; on-line resizing required
old_desc_blocks = 29, new_desc_blocks = 43
The filesystem on /dev/mapper/pve-root is now 88386560 (4k) blocks long.

root@debian:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
udev                  3.7G     0  3.7G   0% /dev
tmpfs                 768M   11M  757M   2% /run
/dev/mapper/pve-root  332G   58G  261G  18% /
tmpfs                 3.8G   46M  3.8G   2% /dev/shm

간단하게 여기서 마치겠습니다.

 

감사합니다.

 

 

반응형

댓글