Storage Pool of LVM type
Not only a file can be allocated to the guest as a virtual disk, but the LV in the VG on the host can also be allocated to the virtual machine as a virtual disk.
However, since LV has no MBR boot record of the disk, it cannot be used as the startup disk of a virtual machine, but can only be used as a data disk.
In this configuration, the VG on the host is a Storage Pool, and the LV in the VG is a Volume. The advantage of LV is that it has better performance; the disadvantage is that it is not as good as image files in terms of management and mobility, and it cannot be used remotely through the network.
Here is an example.
First, a VG with a capacity of 10G is created on the host, named HostVG.
Then create a Storage Pool definition file /etc/libvirt/storage/HostVG.xml with the content of
Then create a new Storage Pool "HostVG" via virsh command
and enable this HostVG
Now we can add LV virtual disk to virtual machine kvm1 in virt-manager.
Click Browse
You can see that HostVG is already in the list of Stroage Pool, select HostVG
Name the volume newlv and set the size to 100MB
Click Finish, newlv is created successfully
Click on Choose Volume
Click Finish to confirm adding newlv as a volume to kvm1
If the new volume is successfully added, an LV named newlv will be added to the host.
Other types of Storage Pools
KVM also supports iSCSI, Ceph and other types of Storage Pools, which will not be introduced here. The most commonly used type is the directory type. For other types, please refer to the document http://libvirt.org/storage.html
In the next section we will start to discuss the network virtualization principle of KVM