Sometimes it turns out, your initial sizing of a VM might have been too small. While RAM and CPU can easily be extended, Disk, on the other hand, might be a different story but usually, the process is rather simple. This is how I tend to do extend a disk that is used by LVM.
First, resize the VM's disk on the hypervisor, note that this command is specific for KVM
X: the disk itself
y: the partition if using any
An example would look like this:
Feel free to comment and / or suggest a topic.
First, resize the VM's disk on the hypervisor, note that this command is specific for KVM
[archy@hyv01 ~]$ sudo virsh blockresize --domain repo.archyslife.lan --path /srv/kvm/vm-images/repo.archyslife.lan-disk1.qcow2 --size 250G
You can verify your changes by running this command [root@hyv01 ~]# sudo virsh domblkinfo --domain repo.archyslife.lan --device vda --human
Capacity: 250.000 GiB
Allocation: 199.435 GiB
Physical: 250.000 GiB
If you are using virtio (like me in this example), the disk should automatically be resized in the VM and you can continue to resize the partition or physical volume. If you're resizing a SATA / SAS / SCSI Disk, you'll have to make the VM rescan the device to make it detect the new size [root@repo ~]# echo 1 > /sys/class/block/sda/device/rescan
Now onto the partitioning of the disk. Resizing can be done in a single command [root@repo ~]# pvresize /dev/vdX(y)
whereX: the disk itself
y: the partition if using any
An example would look like this:
[root@repo ~]# pvresize /dev/vda2
You can now use the additional space as shown in the output of 'pvs' or 'vgs' for resizing.Feel free to comment and / or suggest a topic.
Comments
Post a Comment