In this part 3 of our tutorial, we are discussing how to create and manage KVM Storage volumes and Pools using virt-manager GUI tool.
In general, we use storage devices with different file systems everyday. We have also some storage technologies/techniques like ISCSI, SAN, NAS and so on.
There is no huge different in the basic concepts for our virtual environment, we just use the basic concept to deploy awesome and scale-able virtual storage platform.
With KVM environment , you can use block devices or files as local storage devices within guest operating systems.
We use the physical storage devices to create virtual machineโs volumes. We could describe volumes as a virtual machineโs virtual disk. Volumes cloud be block devices or files as we have mentioned previously.
As a performance consideration, the block devices have the higher hand. Also block files still have the higher hand in the areas of system management and storage capacity use. At any way for scenarios where disk performance from the guest operating system is not critical, its prefer to use disk image files.
Storage volumes also is a part of Storage Pool, actually you canโt create storage volumes before having at least one storage pool.
There is no new prerequisite, just the same one we have discussed in previous parts. If something new I will mention it. So, letโs dive on.
Stage One: Creating Storage Pools in KVM
1. Firstly, letโs display the available pools in our environment by the way we did it before from Details section after right clicking on (localhost) in the main window. This window will appear
As a default, there is one storage pool which called โDefaultโ uses the rootfs partition to store vmโs volumes under /var/lib/libvirt/images path.
In many cases, its not recommended to use this pool, just to make this free space for your system. At any way letโs create our first storage pool by clicking on โ+โ button from the same window.
Next, you may provide the name of your new storage pool and select the type of the storage which will be used to deploy the storage pools. KVM supports nine types:
- -dir โ Uses Filesystem Directory to store storage volumes.
- -disk โ Uses Physical Hard Disks to store storage volumes.
- -fs โ Uses Pre-Formatted Partitions to store storage volumes.
- -netfs โ Uses Network-shared storage like NFS to store storage volumes.
- -gluster โ Depends on Gluster filesystems storage.
- -iscsi โ Uses Network-shared ISCSI storage to store storage volumes.
- -scsi โ Uses local SCSI storage to store storage volumes.
- -lvm โ Depends on LVM Volume groups to store storage volumes.
- -mpath โ
At the moment, multipathing Volume creation is not supported.
You may be familiar with a lot of them, but we will discuss one or two of them for this tutorial. Lets start with the popular one, (dir) type.
(Dir) type is very popular used as it doesnโt require many modification in current storage schema you have.
3. There is no restriction where the storage pool will be created, but it is very recommended to create โSPool1โ directory on separate partition. One important thing also is to give the right permissions and ownership for this directory.
I will use /dev/sda3 as my partition, you may have a different one. Make sure you have mounted it properly.
# mount -t ext4 /dev/sda3 /mnt/personal-data/
4. After mounting the partition under โ/mnt/personal-data/โ directory, then provide the path of mount point to that storage directory (i.e. /mnt/personal-data/SPool1).
5. After finishing, you will find new storage pool โSPool1โ appeared in the list.
Before going to the stage two to create volumes, Letโs discuss another type of our Storage Pool called fs.
The (FS) type is depends on Preformatted partitions and it is useful for whom want to specify complete partition for virtual machine disks/storage.
6. We will create another storage pool using per-formatted partition that is the ((fs) Pre-Formatted Block Device) type. You need to prepare another new partition with desired file system.
You could use โfdiskโ or โpartedโ to create new partition and use โmkfsโ for formatting with new file-system. For this section, (sda6) will be our new partition.
# mkfs.ext4 /dev/sda6
Also create a new directory (i.e. SPool2), it acts as a mount point for the selected partition.
7. After selecting (fs) type from the drop-menu, next provide the name of the new pool as shown
8. In the next window, you need to provide the path of your partition โ/dev/sda6โ in our case โ in the โSource Pathโ field and the path of the directory which acts as a mount point /mnt/personal-data/SPool2 in the โTarget Pathโ field.
9. Finally, there is a third storage pool added in the main storage list.
So, we will discuss deploying another storage types in our next part using CLI tools, for now letโs move to create volumes.
Stage Two: Create Storage Volumes
As we discussed before, you could consider the storage volumes as a virtual disks for virtual machines. We also still have many formats for this volumes.
In general, this formats allow you to use your volumes with QEMU, VMware, Oracle VirtualBox and Hyper-V.
10. Select the storage pool which you want to storage volume be part of โNew Volumeโ. Press on โNew Volumeโ button to start.
11. Next, provide the name of the new volume and select the format of it. Donโt forget to set proper size also.
12. Now your volume is ready to attached with virtual machines
Conclusion
Now youโve learned the difference between Storage Pools and Volumes and how to create and manage them under KVM environment using virt-manager GUI tool. Also we discussed the types of Pools and the importance of volumeโs formats. Itโs your turn to make your hands more dirty.
Reference Links
KVM HomePage
KVM Documentation
If this article helped you solve a problem, consider buying a coffee. It helps keep TecMint free, supports the authors, and keeps the project going.

Got Something to Say? Join the Discussion... Cancel reply