728x90
VMware ESXi 환경에서 리눅스 가상 머신(VM)의 하드 디스크 용량을 증설하는 방법 - CentOS
ESXi 관리자에서 VM 설정 열기
VMware ESXi 관리자에서 VM을 선택하고 "편집 가상 머신 설정" 또는 유사한 옵션을 선택하여 VM 설정을 엽니다.
하드 디스크 추가
VM 설정에서 "하드웨어" 탭을 선택하고 하드 디스크를 추가합니다. 새로운 하드 디스크를 추가할 때 증설할 용량을 지정합니다. 증설할 용량은 원하는 크기로 설정합니다.
물리 디스크 증설
** 데이터스토어 용량 부족 이슈로 별도의 하드 디스크 추가
- VM 하드 디스크 1(120 GB)
- VM 하드 디스크 2 생성(200 GB)
논리 볼륨 관리자(LVM) 구성하기
df -Th | egrep -v tmpfs
$ df -Th | egrep -v tmpfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg0-lv--0 ext4 44G 37G 5.5G 87% /
/dev/sda2 ext4 974M 252M 655M 28% /boot
파티션 구성
- 디스크 및 파티션 정보 확인
fdisk -l /dev/sdb
$ fdisk -l /dev/sdb
Disk /dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
- /dev/sdb 파티션 생성
fdisk /dev/sdb
n > Enter > Enter > Enter > Enter > w
$ fdisk /dev/sdb
Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x4086ea68.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-209715199, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-209715199, default 209715199):
Created a new partition 1 of type 'Linux' and of size 100 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
- 생성된 파티션 정보 확인
fdisk -l /dev/sdb
$ fdisk -l /dev/sdb
Disk /dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xef2581e2
Device Boot Start End Blocks Id System
/dev/sdb1 2048 419430399 209714176 83 Linux
물리 볼륨(Physical Volume)
- PV(물리 볼륨) 정보 확인
pvs
$ pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <119.00g 0
pvdisplay
$ pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name centos
PV Size <119.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 30463
Free PE 0
Allocated PE 30463
PV UUID WzmLIi-Ry2j-k73d-pvrA-Q9ke-5g1E-0HjHvd
- PV(물리 볼륨) 생성
pvcreate /dev/sdb1
$ pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
- 생성된 PV(물리 볼륨) 정보 확인
pvs
$ pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <119.00g 0
/dev/sdb1 centos lvm2 a-- <200.00g <200.00g
pvdisplay
$ pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name centos
PV Size <119.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 30463
Free PE 0
Allocated PE 30463
PV UUID WzmLIi-Ry2j-k73d-pvrA-Q9ke-5g1E-0HjHvd
"/dev/sdb1" is a new physical volume of "<200.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size <200.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 0GxagH-TpRu-Qd3s-7t3S-KNTD-iZXD-cAFHAS
728x90
볼륨 그룹(Volume Group)
- VG(볼륨 그룹) 정보 확인
vgs
$ vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <119.00g 0
vgdisplay
$ vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
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 <119.00 GiB
PE Size 4.00 MiB
Total PE 30463
Alloc PE / Size 30463 / <119.00 GiB
Free PE / Size 0 / 0
VG UUID Ua9i3r-AcCb-0SjS-fjov-QbRG-HMzu-Zvs8VT
- VG(볼륨 그룹) 확장
vgextend centos /dev/sdb1
$ vgextend centos /dev/sdb1
Volume group "centos" successfully extended
- 확장된 VG(볼륨 그룹) 정보 확인
vgs
$ vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz--n- 318.99g <200.00g
vgdisplay
$ vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
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 318.99 GiB
PE Size 4.00 MiB
Total PE 81662
Alloc PE / Size 30463 / <119.00 GiB
Free PE / Size 51199 / <200.00 GiB
VG UUID Ua9i3r-AcCb-0SjS-fjov-QbRG-HMzu-Zvs8VT
논리 볼륨(Logical Volume)
- LV(논리 볼륨) 정보 확인
lvs
$ lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- <111.00g
swap centos -wi-ao---- 8.00g
lvdisplay
$ lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID Lysew0-r4td-ZDfH-U3CW-dvC9-I20P-vZuhnt
LV Write Access read/write
LV Creation host, time serv-203, 2022-03-03 11:36:18 +0900
LV Status available
# open 2
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID diFdl0-h8bc-NI3A-LBqM-oRw6-fzkf-IBp59G
LV Write Access read/write
LV Creation host, time serv-203, 2022-03-03 11:36:18 +0900
LV Status available
# open 1
LV Size <111.00 GiB
Current LE 28415
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
- 기존 LV(논리 볼륨) 확장
lvextend -l +100%FREE /dev/centos/root
$ lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from <111.00 GiB (28415 extents) to 310.99 GiB (79614 extents).
Logical volume centos/root successfully resized.
- 확장된 LV(논리 볼륨) 정보 확인
$ lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 310.99g
swap centos -wi-ao---- 8.00g
$ lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID Lysew0-r4td-ZDfH-U3CW-dvC9-I20P-vZuhnt
LV Write Access read/write
LV Creation host, time serv-203, 2022-03-03 11:36:18 +0900
LV Status available
# open 2
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID diFdl0-h8bc-NI3A-LBqM-oRw6-fzkf-IBp59G
LV Write Access read/write
LV Creation host, time serv-203, 2022-03-03 11:36:18 +0900
LV Status available
# open 1
LV Size 310.99 GiB
Current LE 79614
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
파일시스템(Filesystem)
- 스토리지 디바이스 정보 확인
lsblk
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 120G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 119G 0 part
├─centos-root 253:0 0 311G 0 lvm /
└─centos-swap 253:1 0 8G 0 lvm [SWAP]
sdb 8:16 0 200G 0 disk
└─sdb1 8:17 0 200G 0 part
└─centos-root 253:0 0 311G 0 lvm /
sr0 11:0 1 1024M 0 rom
-f 옵션으로 파일시스템 정보 확인
lsblk -f
$ lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1 xfs efca6237-2489-42a9-b4d2-f09d324e3512 /boot
└─sda2 LVM2_member WzmLIi-Ry2j-k73d-pvrA-Q9ke-5g1E-0HjHvd
├─centos-root xfs 6ed0780f-08ef-40b7-9025-b0506926e0ce /
└─centos-swap swap 09510e97-1235-4d5d-a908-5d7a68729438 [SWAP]
sdb
└─sdb1 LVM2_member 0GxagH-TpRu-Qd3s-7t3S-KNTD-iZXD-cAFHAS
└─centos-root xfs 6ed0780f-08ef-40b7-9025-b0506926e0ce /
sr0
- 파일시스템 용량 확인
df -Th | egrep -v tmpfs
$ df -Th | egrep -v tmpfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 111G 65G 47G 59% /
/dev/sda1 xfs 1014M 171M 844M 17% /boot
- 파일시스템 확장
xfs_growfs -d /
$ xfs_growfs -d /
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=7274240 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=29096960, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=14207, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 29096960 to 81524736
- 확장된 파일시스템 용량 확인
$ df -Th | egrep -v tmpfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 311G 65G 247G 21% /
/dev/sda1 xfs 1014M 171M 844M 17% /boot
728x90
'리눅스' 카테고리의 다른 글
[리눅스] docker ps filter 옵션 (0) | 2022.03.31 |
---|---|
[리눅스] MySQL 5.7 이후 버전 root 비밀번호 변경 (0) | 2022.03.30 |
paste 명령어 (0) | 2022.03.29 |
[리눅스] 젠킨스 빌드 이름 및 설명 설정자(Build Name and Description Setter) 플러그인 (0) | 2022.03.28 |
[draft] 프라이빗 Docker Registry를 사용하는 방법 (0) | 2022.03.28 |