If you followed my previous article on deploying a nested ESXi on KVM, you may eventually need to increase the size of the default datastore1 as you continue your experimentation and deployments.
Do not simply increase the size of the original backing KVM qcow2 disk (qemu-img resize), because then you would need to get this recognized within the ESXi host. Instead, add a new KVM disk and add an extent to datastore1 from the ESXi embedded web host client.
Add disk to ESXi guest VM
From the GUI Virtualization Manager (virt-manager), double-click the esxi host and pull up its properties. Then click the “Add Hardware” button.
Select “Storage” from the left, and then “Create a disk image from the virtual machine” and select the capacity size you want similar to the screenshot below.
Or if the default pool does not have enough space, instead select the radio button “Select or create custom storage” and you can choose the KVM file pool. Regardless, press “Finish” and now the ESXI guest VM will have an extra virtual drive.
The drive created is sparse, meaning it is not allocated at the full capacity size, and instead will grow as needed. This can be confirmed with ‘qemu-img’ from the command line.
# 100G disk, but currently only taking 196Kb of disk space $ sudo qemu-img info <diskname>.qcow2 file format: qcow2 virtual size: 100 GiB (107374182400 bytes) disk size: 196 KiB cluster_size: 65536 backing file: /data/kvm/pool backing file format: raw Format specific information: compat: 1.1 lazy refcounts: true refcount bits: 16 corrupt: false
And you can see the disk is attached to the guest VM using virsh.
# show libvirt definition of esxi1 # which shows disk is attached $ virsh dumpxml esxi1 | grep esxi1-data2.qcow2 -B2 -A5 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/data/kvm/esxi1-data2.qcow2' index='1'/> <backingStore/> <target dev='sda' bus='scsi'/> <alias name='scsi0-0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk>
Adding disk to VMware datastore1
From the ESXi embedded host client (https://esxi1.home.lab, user=root), select Storage > New datastore. Then “Add an extent to an existing datastore”.
Select “datastore1”, and then you will be presented with the new disk you just added in KVM. Press Next
You will be presented with partition options to use the whole drive, press “Next”.
Press “Finish” and then “Yes” when warned that the entire disk will be erased, because the new disk we just added is empty anyway.
The storage for “datastore1” will now reflect the additional capacity of the disk you just added.
REFERENCES
NOTES
If esxi hangs on esxi “nfs41client loaded” when starting then goes to paused state
check for disk full on KVM host pool location
check cqow2 sparse disk size when VM is powered on
sudo qemu-img info seedvm.qcow2 --force-share