Log in op de KVM host.
stop de betreffende VM: virsh shutdown guest1
maak de virtuele disk voor de betreffende vm groter, bijvoorbeeld 5Gb groter:
qemu-img resize /var/lib/libvirt/images/guest1.qcow2 +5G
maakt vervolgens offline de partitie voor de Volumegroup waar de / lv in zit groter. vindt eerst de partitie naam:
virt-filesystems –long -h –all -a guest1.qcow2:
Name Type VFS Label MBR Size Parent /dev/sda1 filesystem xfs - - 500M - /dev/centos/root filesystem xfs - - 6,7G - /dev/centos/swap filesystem swap - - 820M - /dev/centos/root lv - - - 6,7G /dev/centos /dev/centos/swap lv - - - 820M /dev/centos /dev/centos vg - - - 7,5G /dev/sda2 /dev/sda2 pv - - - 7,5G - /dev/sda1 partition - - 83 500M /dev/sda /dev/sda2 partition - - 8e 7,5G /dev/sda /dev/sda device - - - 8,0G
in dit geval dus /dev/sda2
vergroot deze door:
cp guest1.qcow2 guest1-copy.qcow2
virt-resize –expand /dev/sda2 guest1-copy.qcow2 guest1.qcow2
start nu de VM: virsh start guest1 en log in op de VM.
vind de juiste PV: pvscan
PV /dev/vda2 VG centos lvm2 [<12,51 GiB / 5,00 GiB free] Total: 1 [<12,51 GiB] / in use: 1 [<12,51 GiB] / in no VG: 0 [0 ]
breid de Physical Volume uit tot de ruimte op de schijf pvresize /dev/vda2
Physical volume "/dev/vda2" changed 1 physical volume(s) resized or updated / 0 physical volume(s) not resized vind de juiste logical volume: ''df'' <code> Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root 7022592 4345000 2677592 62% / devtmpfs 3992760 0 3992760 0% /dev tmpfs 4004628 4 4004624 1% /dev/shm tmpfs 4004628 8824 3995804 1% /run tmpfs 4004628 0 4004628 0% /sys/fs/cgroup /dev/vda1 508588 261292 247296 52% /boot tmpfs 800928 0 800928 0% /run/user/0
breid vervolgens het root logical volume uit: lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from <6,71 GiB (1717 extents) to <11,71 GiB (2997 extents). Logical volume centos/root successfully resized.
En breid het filesysteem op die LV uit: fs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=439552 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0
data = bsize=4096 blocks=1758208, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 1758208 to 3068928