KVM Storage Virtualization-5 minutes a day to play with OpenStack (7)

Source: Internet
Author: User

650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160313-1457875033081040973.jpg "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;background-color: RGB (246,246,246); "/>

KVM storage virtualization is managed through storage pools (Storage pool) and volumes (Volume).

Storage Pool is a storage space that can be seen on the host, and can be of various types, discussed in detail later. Volume is a space that is partitioned in the Storage Pool, where the host assigns Volume to the virtual machine, and Volume sees a hard disk in the virtual machine.

Below we study different types of Storage Pool

directory type of Storage Pool

The file directory is the most commonly used Storage Pool type.
KVM hosts the host directory/var/lib/libvirt/images/as the default Storage Pool.

So what is Volume?
The answer is the file below the directory, and a file is a Volume.

Do you remember when we created the first virtual machine kvm1, the image file Cirros-0.3.3-x8664-disk.img placed in this directory. The file cirros-0.3.3-x8664-disk.img, or volume, is the startup disk for KVM1.

650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160313-1457875033506086282.jpg "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;white-space: Normal;background-color:rgb (246,246,246); "/>

How does the KVM know to take/var/lib/libvirt/images as the default Storage Where's the Pool? In fact, all of the KVM Storage pool can be defined in the host's/etc/libvirt/storage directory, each Pool an XML file, the default is a default.xml, the content is as follows:

650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160313-1457875033783026482.jpg "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;white-space: Normal;background-color:rgb (246,246,246); "/>

Note: The type of Storage Pool is "dir", and the path to the directory is/var/lib/libvirt/images

Now let's add a new disk for the virtual machine kvm1 to see what's changed. Open the KVM1 configuration page in Virt-manager and right-click to add New hardware

650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160313-1457875038029032821.jpg "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;white-space: Normal;background-color:rgb (246,246,246); "/>

Create a 8G volume in the default Pool.

650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160313-1457875038314009772.jpg "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;white-space: Normal;background-color:rgb (246,246,246); "/>

click "Finish" to see the information for the new disk.

   650) this.width=650; "src="/HTTP/ Ipaiban.com/js/ueditor/themes/default/images/spacer.gif "style=" border:1px solid rgb (221,221,221); Background:url ( "Http://ipaiban.com/js/ueditor/lang/zh-cn/images/localimage.png") no-repeat 50% 50%; "/>650) this.width=650;" Title= "" src= "http://7xo6kd.com1.z0.glb.clouddn.com/upload-ueditor-image-20160313-1457875038718036635.png" style = "Border:0px;vertical-align:middle;color:rgb (63,63,63); font-family: ' Microsoft Yahei '; font-size:15px;line-height : 21.75px;text-align:justify;white-space:normal;background-color:rgb (246,246,246); "/>

More than a 8G file under the/var/lib/libvirt/images/kvm1.img

[Email protected]:~# ls-l/var/lib/libvirt/images/
Total 14044-rw-r--r--1 root root 14417920 Sep 4 11:24 cirros-0.3.3-x86_64-disk.img-rw-------1 root root 8589934592 Se P 4 21:39 kvm1.img

Using files to do Volume has many advantages: convenient storage, good portability, replication, and remote access. The first few advantages are well understood, here is the "remote access" to explain more.

Remote access means that the image files are not necessarily placed on the host local file system, or can be stored on a network-connected remote file system, such as NFS, or distributed file systems such as GlusterFS.

This allows the image file to be shared among multiple host hosts, making it easy for virtual machines to Live migration between host hosts and, in the case of a distributed file system, a multi-copy feature that ensures high availability of the image files.

KVM supports multiple Volume file formats and can be selected when adding Volume

650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160313-1457875039054010932.png "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;white-space: Normal;background-color:rgb (246,246,246); "/>

Raw is the default format, the original disk image format, good portability, good performance, but fixed size, can not save disk space.

Qcow2 is the recommended format, cow represents copy on write, which saves disk space, supports AES encryption, supports zlib compression, supports multiple snapshots, and features many functions.

VMDK is a virtual disk format for VMware, which means that VMware virtual machines can run directly on KVM.

The next section describes the Storage Pool for LVM types.

650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160313-1457875040598057697.jpg "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;white-space: Normal;background-color:rgb (246,246,246); "/>


KVM Storage Virtualization-5 minutes a day to play with OpenStack (7)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.