# 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
我尝试将卷定义到 VM 但失败了。我在 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).
不使用 XML 时结果相同
# 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).
使用 GUI 时结果相同
# virsh pool-dumpxml dsk-b
<pool type='disk'>
<name>dsk-b</name>
<uuid>e58b5005-ef7b-43b9-a420-73779ccf74a3</uuid>
<capacity unit='bytes'>480103964160</capacity>
<allocation unit='bytes'>0</allocation>
<available unit='bytes'>480103946752</available>
<source>
<device path='/dev/sdb'>
<freeExtent start='17408' end='480103964160'/>
</device>
<format type='gpt'/>
</source>
<target>
<path>/dev</path>
</target>
</pool>
# virsh -c qemu:///system version --daemon
Compiled against library: libvirt 1.3.1
Using library: libvirt 1.3.1
Using API: QEMU 1.3.1
Running hypervisor: QEMU 2.5.0
Running against daemon: 1.3.1