3

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'>
    <name>guest_images_disk</name>
    <source>
        <device path='/dev/sdb' />
        <format type='gpt' />
    </source>
    <target>
        <path>/dev</path>
    </target>
</pool>

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.

user2887201
  • 223
  • 1
  • 2
  • 5

1 Answers1

0

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
partprobe

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

systemctl reload libvirtd
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • My drive has one partition which is the size of the entire disk. I would like to add the partition to the storage pool – user2887201 Apr 30 '15 at 17:15
  • Huh? Why do you want to use the partition? – Michael Hampton Apr 30 '15 at 17:17
  • Check "Warning" under section 13.1, https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/chap-Virtualization_Administration_Guide-Storage_Pools-Storage_Pools.html – user2887201 Apr 30 '15 at 17:22
  • Ah, right, well then change the storage pool to reference `/dev/sdb1`. – Michael Hampton Apr 30 '15 at 17:23
  • So, when I explicitly mention partition no, I get the following message when I do pool-create. error: Failed to create pool from xmlfiles/storage_pool_1.xml error: Storage volume not found: no storage vol with matching path '/dev/sdb1p1' – user2887201 Apr 30 '15 at 17:25
  • Any ideas where I might be wrong? – user2887201 May 01 '15 at 16:09