Three storage modes of KVM virtual machines

Source: Internet
Author: User

KVM supports multiple storage options, including virtual disk files, file system-based storage, and device-based storage.

Virtual Disk File

To implement kernel-based Virtual Machine (KVM) storage management, you can use LVM (logical volume manager) and create a storage pool. When the system creates a KVM virtual machine, the virtual disk file is used as the backend storage by default. After the installation, the virtual machine considers it to be using a real disk, but what it actually sees is the virtual disk file used to simulate the hard disk. This additional file system layer reduces the system speed.

Of course, the Virtual Disks Based on disk images are not completely beneficial. The disk file system can be easily used for other KVM virtual hosts. However, if you want to optimize the KVM virtualization performance, you 'd better consider other storage methods.

File System-based KVM Storage

When installing a KVM host, the optional file system is Dir (directory) or FS (formatted Block Storage) as the initial KVM storage format. The default option is dir. You can specify a directory in the local file system to create disk image files.

The FS option allows you to specify the name of a formatted file system and use it as a dedicated disk image file storage. The main difference between the two KVM storage options is that the FS file system does not need to be mounted to a specific partition.

Either of the two options can be a local file system or a Network File System on a physical host on San. The latter has some advantages, because SAN can easily achieve simultaneous access from multiple hosts, while local disks or file systems cannot.

Another file-based disk storage method is netfs. You can specify the name of a Network File System, such as samba. this method is convenient for KVM storage, because it is easy to access the file system located on other servers, and users can also access disk files through multiple hosts.

All of these file-based KVM storage methods have one drawback: inherent defects in the file system. Because the virtual machine's disk files cannot be directly read or written to the KVM storage device, but are written to the file system on the OS of the host machine. This means that an additional layer is added between accessing and writing files, which usually reduces performance. Therefore, if you want to find the optimal solution for KVM virtualization performance, you 'd better consider device-based storage.

Device-based KVM Storage

Another KVM storage method is device-based. Four different types of physical storage are supported: disks, iSCSI, SCSI, and logical disks. Disk mode refers to the direct reading/writing of hard disk devices. The iSCSI and SCSI modes are optional, depending on whether the user uses the SCSI or iSCSI address to connect the disk device. The advantage of this KVM storage method is that the disk name is fixed and does not need to be determined by the order in which the host OS searches for disk devices.

This method of connecting to a disk also has disadvantages: lack of flexibility. The size of the virtual disk is difficult to change, and the device-based KVM storage does not support snapshots.

To optimize the flexibility of KVM storage, you can use LVM (logical volume manager ). The advantage of LVM is that snapshots can be used, while snapshots are not included in KVM virtualization.

LVM can put all the storage in a volume group to easily create a logical volume. This volume group is an abstraction of physical disk devices. If the maximum available disk space is exceeded, you can also add new devices to the volume group, which greatly simplifies the process of adding storage space, the added space can be used directly in the logical volume. The use of LVM makes disk space allocation more flexible, and it is easier to add or delete storage.

Finally, LVM can work well in a single-host or multi-host environment. In a multi-host environment, you can create logical volumes on the San. If you use cluster LVM, you can easily configure multiple hosts to access a logical volume at the same time.

Use KVM storage pool

To simplify KVM storage management, you can create a storage pool. Creating a storage pool on the host simplifies the management of KVM storage devices. The storage pool can also be used to allocate the reserved storage space in advance. This policy is very effective for large application environments, and the management of storage administrators and virtual machines is often not the same person. In this way, it is good to complete the creation of the KVM storage pool before creating the first virtual machine.

When you decide to start KVM virtualization, create a KVM storage pool on the host, and then provide LVM logical volumes through this pool. Users will not regret using the snapshot feature added by LVM. This KVM storage method provides great flexibility.

The above is the reposted content of the network. According to your own research and writing plan, the configuration experiment of the kvm storage pool will be completed and written as a blog post in the future...

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.