Create KVM storage pool using a ext4 formatted drive

user2887201 asked:

I have a secondary hdd that I would like to use as a storage pool for my KVM host.
Here is the xml file I use to create the storage pool,

<pool type='disk'>
        <device path='/dev/sdb' />
        <format type='gpt' />

Here is the pool-info output after createing and starting the storage pool,

Name:           guest_images_disk
UUID:           779b1ad8-093f-4c7f-a32e-4d120101088b
State:          running
Persistent:     no
Autostart:      no
Capacity:       931.51 GiB
Allocation:     931.51 GiB
Available:      992.50 KiB

As one can see, even thought there is only one partition in my hdd, KVM doesn’t make available the entire allocated space.

My answer:

Libvirt can’t make use of the space on your disk, because the disk is full.

When you tell libvirt to use a whole disk device, it expects to be able to use the entire block device, ignoring any existing partitions.

To resolve the problem, delete the partitions, or erase the partition table from the device:

dd bs=512 count=1 if=/dev/zero of=/dev/sdb

If you are suggested to reboot, then reboot. Otherwise, reload libvirtd:

systemctl reload libvirtd

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.