How to define volume in QEMU/KVM disk pool

AlexEv1337

Member
Joined
Dec 20, 2020
Messages
35
Reaction score
3
Credits
395
I try to define volume to VM but failed. The same result I receive in GUI.

# virsh pool-list
Name State Autostart
-------------------------------------------
default active yes
dsk-b active yes
dsk-c active yes

# virsh pool-info dsk-b
Name: dsk-b
UUID: e58b5005-ef7b-43b9-a420-73779ccf74a3
State: running
Persistent: yes
Autostart: yes
Capacity: 447.13 GiB
Allocation: 0.00 B
Available: 447.13 GiB

# cat Vol226.xml
<volume>
<name>U226</name>
<source>
<device path='/dev/sdb'>
<extent start='2048' end='33554465'/>
</device>
</source>
<capacity>17179869184</capacity>
<allocation>17179869184</allocation>
</volume>

# virsh vol-create dsk-b Vol226.xml
error: Failed to create vol from Vol226.xml
error: internal error: Child process (/sbin/parted /dev/sdb mkpart --script primary 17408B 17179886591B) unexpected exit status 1: Error: You requested a partition from 17.4kB to 17.2GB (sectors 34..33554465).
The closest location we can manage is 1049kB to 17.2GB (sectors 2048..33554465).
 

Attachments

  • Screenshot from 2021-02-07 04.26.371.png
    Screenshot from 2021-02-07 04.26.371.png
    700.9 KB · Views: 259


Try partitioning /dev/sdb first and then and then adding it to a storage pool before creating a disk for your vm from that storage pool.
 
Of course, partitioning by fdisk is not a problem, but how to define separate partition as volume for libvirtd service? And how to see defined partition in VM manager? I don't see guide.
 
I saw it wrong, it's been while since I've done anything like that with KVM. Can you try naming the volume sdb1 instead of U226 and then try creating it, when I try it's requiring the volume to be named after the partition it's creating.
 
this is attempt without XML at all

# virsh vol-create-as dsk-b sdb1 16G
error: Failed to create vol sdb1
error: internal error: Child process (/sbin/parted /dev/sdb mkpart --script primary 17408B 17179886591B) unexpected exit status 1: Error: You requested a partition from 17.4kB to 17.2GB (sectors 34..33554465).
The closest location we can manage is 1049kB to 17.2GB (sectors 2048..33554465).
 
Can you share the output of the following: fdisk -l /dev/sdb
 
# fdisk -l /dev/sdb
Disk /dev/sdb: 447.1 GiB, 480103981056 bytes, 937703088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 518EC549-4DA3-4584-8738-5567F62C8056
 
When I tried it it didn't like gpt partition table but it required a dos partition table, otherwise I would just try a setup with a LVM storage pool
 
Last edited:
Thank, you @f33dm3bits , now I try another way, I fully destroy server and try to go to Ubuntu 20.10 - my expectations is new version of KVM in Ubuntu 20.10, but of course if issue will repeated I change partition type to dos. Thank you.
 

Members online


Top