A, KVM introduce storage virtualization
KVM storage virtualization through storage pool (Storage Pool) and volume (Volume) to manage.
Storage Pool on the host is a storage space can be seen, it may be various type;
Volume is divided in a Storage Pool in space, will host the virtual machine is assigned to Volume, Volume seen in the virtual machine is a hard drive.
Second, the directory type of Storage Pool
File directory is the most common type of Storage Pool. The KVM host directory / var / lib / libvirt / images / Storage Pool as the default
Volume is the directory of files, a file is a Volume.
KVM should know how it is / var / lib / libvirt / images directory as the default Storage Pool it?
Storage Pool KVM practically all may be used are defined in the host's / etc / libvirt the / storage directory, each Pool an xml file, as follows:
There is a default default.xml, which reads as follows: Note: The type of the path Storage Pool "dir", the directory is / var / lib / libvirt / images
Third, create a Storage Pool
(1) opens in virt-manager in a virtual machine, to add a hard disk, perform the following:
(2) Select Management, the following dialog box, click on the left "+" to add a new pop-up storage pool from a random name, click on the "Forward"
(3) write path to prepare the new storage pool in the "target path", click "Finish":
(4) After a new pool called kem-storage memory, which path / kvm-storag
(5) delete a storage pool: storage pool first stop, and then delete
Fourth, the virtual machine to add volume
(1) on a path we created as / kvm-storage of Storage-Pool, add volume in this Pool, a name and set the size:
(3)点击“完成”后,虚机中多了一个“磁盘2”
以上创建的卷 volume01.qcow2 是一个文件,路径在/kvm-storage。使用文件做 Volume 有很多优点:存储方便、移植性好、可复制。
KVM 支持多种 Volume 文件格式:
raw:是默认格式,即原始磁盘镜像格式,移植性好,性能好,但大小固定,不能节省磁盘空间。
qcow2:是推荐使用的格式,cow 表示 copy on write,能够节省磁盘空间,支持 AES 加密,支持 zlib 压缩,支持多快照,功能很多。
vmdk:是 VMWare 的虚拟磁盘格式,也就是说 VMWare 虚机可以直接在 KVM上 运行。