bismillah ..
seperti di postingan sebelum nya di https://aldykustyandi.com/resize-disk-guest-vm-di-proxmox/ , kali ini yang akan di resize adalah vm dengan OS centos 7 , basis disk nya menggunakan LVM jadi agak berbeda
pertama resize di menu hardware di web console proxmox seperti sebelum nya , kemudian kita ssh ke vm kita lakukan resize physical volume , volume group kemudian logical voulume nya
berikut posisi sebelum di resize lvm nya tapi sudah di resize virtual disk dari web console promxox , terlihat di fdisk -l
[root@#localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 834M 7.0G 11% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 28G 23G 5.5G 81% /
/dev/sda1 1014M 205M 810M 21% /boot
tmpfs 1.6G 0 1.6G 0% /run/user/0
[root@#localhost ~]# fdisk -l
Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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: 0x000b569f
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 67108863 32504832 8e Linux LVM
Disk /dev/mapper/centos-root: 29.8 GB, 29842472960 bytes, 58286080 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 /dev/mapper/centos-swap: 3435 MB, 3435134976 bytes, 6709248 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
[root@#localhost ~]#
[root@#localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID FUJ6cb-rsff-xHEK-ADlZ-PZ5I-TcDc-1uO18G
LV Write Access read/write
LV Creation host, time localhost, 2022-03-15 10:45:33 +0700
LV Status available
# open 2
LV Size <3.20 GiB
Current LE 819
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 sBF2Ku-s1jX-ft3y-nVUn-vl1x-O0Hf-kj0KEd
LV Write Access read/write
LV Creation host, time localhost, 2022-03-15 10:45:33 +0700
LV Status available
# open 1
LV Size 27.79 GiB
Current LE 7115
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
[root@#localhost ~]#
[root@#localhost ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name centos
PV Size <31.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 7935
Free PE 1
Allocated PE 7934
PV UUID 43uyfG-A1Kk-hc6d-K0BD-seZn-RpHN-gamFGV
[root@#localhost ~]# 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 <31.00 GiB
PE Size 4.00 MiB
Total PE 7935
Alloc PE / Size 7934 / 30.99 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID 7ARuiy-XcyI-Sa9l-wU2E-Cesk-Cnca-pUqt98
[root@#localhost ~]#
pertama kita resize partisi nya dengan parted kemudian resize physical volume nya
[root@#localhost ~]# parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) resizepart 2 100%
(parted) quit
Information: You may need to update /etc/fstab.
[root@#localhost ~]#
[root@#localhost ~]# pvresize /dev/sda2
Physical volume "/dev/sda2" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
[root@#localhost ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
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 1
Act PV 1
VG Size <49.00 GiB
PE Size 4.00 MiB
Total PE 12543
Alloc PE / Size 7934 / 30.99 GiB
Free PE / Size 4609 / 18.00 GiB
VG UUID 7ARuiy-XcyI-Sa9l-wU2E-Cesk-Cnca-pUqt98
[root@#localhost ~]#
[root@#localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID FUJ6cb-rsff-xHEK-ADlZ-PZ5I-TcDc-1uO18G
LV Write Access read/write
LV Creation host, time localhost, 2022-03-15 10:45:33 +0700
LV Status available
# open 2
LV Size <3.20 GiB
Current LE 819
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 sBF2Ku-s1jX-ft3y-nVUn-vl1x-O0Hf-kj0KEd
LV Write Access read/write
LV Creation host, time localhost, 2022-03-15 10:45:33 +0700
LV Status available
# open 1
LV Size 27.79 GiB
Current LE 7115
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
[root@#localhost ~]#
terlihat dari command vgdisplay VG size nya sudah bertambah , tapi lv Size masih sama
kemudia kita resize logical volume nya
[root@#localhost ~]# lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from 27.79 GiB (7115 extents) to <45.80 GiB (11724 extents).
Logical volume centos/root successfully resized.
[root@#localhost ~]#
[root@#localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID FUJ6cb-rsff-xHEK-ADlZ-PZ5I-TcDc-1uO18G
LV Write Access read/write
LV Creation host, time localhost, 2022-03-15 10:45:33 +0700
LV Status available
# open 2
LV Size <3.20 GiB
Current LE 819
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 sBF2Ku-s1jX-ft3y-nVUn-vl1x-O0Hf-kj0KEd
LV Write Access read/write
LV Creation host, time localhost, 2022-03-15 10:45:33 +0700
LV Status available
# open 1
LV Size <45.80 GiB
Current LE 11724
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
[root@#localhost ~]#
LV Size nya sudah bertambah
terahir kita resize di filesystem nya , centos ini menggunakan xfs maka akan kita resize dengan xfs_growfs
[root@#localhost ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs tmpfs 7.8G 834M 7.0G 11% /run
tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 28G 23G 5.5G 81% /
/dev/sda1 xfs 1014M 205M 810M 21% /boot
tmpfs tmpfs 1.6G 0 1.6G 0% /run/user/0
[root@#localhost ~]#
[root@#localhost ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=1821440 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=7285760, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=3557, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 7285760 to 12005376
[root@#localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 834M 7.0G 11% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 46G 23G 24G 49% /
/dev/sda1 1014M 205M 810M 21% /boot
tmpfs 1.6G 0 1.6G 0% /run/user/0
[root@#localhost ~]#
terlihat sekarng secara system centos ,size disk sudah bertambah