Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement KVM Virtualized Storage Pool

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to realize KVM virtualization storage pool, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.

Before you can create a virtual machine, you need to create a storage pool. Storage pools are storage locations where virtual machines are placed on host machines, either local or network storage, and specific virtual machine instances are placed on volumes.

storage pool

Storage pools are the storage locations where virtual disks of virtual machines are placed on the host machine. The default storage is under the/var/lib/libvirt/images directory. Due to space planning for hard disks and virtual disks, virtual disks of virtual machines are generally stored centrally under the/home/kvm/images directory or planned directories for convenient management. The command line for operating storage volumes is virsh.

Create folder-based storage pools

[root@e3 ~]# mkdir /data/kvm/vmfs[root@e3 ~]# ll /data/kvm/vmfs Total Usage 0[root@e3 ~]# ll -d /data/kvm/vmfsdrwxr-xr-x. 2 root root 4096 Jan 22 10:08 /data/kvm/vmfs

Defining Storage Pools in Directories

[root@e3 ~]# virsh pool-define-as vmdisk --type dir --target /data/kvm/vmfs/ #definition pool vmdisk

Create defined storage pools

[root@e3 ~]# virsh pool-build vmdisk build pool vmdisk

View Activity Pool

[root@e3 ~]# virsh pool-list --all names state Automatic Start----------------------------------------- activities no vmdisk Inactive No

View pool information

[root@e3 ~]# virsh pool-info vmdisk Name: vmdiskUUID: 2f01b1c0-2852-4a35-895a-0e82c05d5fec Status: Inactive persistent: Yes Automatic start: No

Activate the pool and power it on automatically

[root@e3 ~]# virsh pool-autostart vmdisk pool vmdisk marked for autostart [root@e3 ~]# virsh pool-start vmdisk pool vmdisk started #This creates a local file-based host pool

Create virtual machine storage volumes in storage pools

[root@e3 ~]# virsh vol-create-as vmdisk test.qcow2 20G --format qcow2 Create volume test.qcow2 [root@e3 ~]# cd /data/kvm/vmfs/[root@e3 vmfs]# lstest.qcow2[root@e3 vmfs]# ll Total usage 196-rw-----. 1 root root 197120 Jan 22 10:20 test.qcow2

Close a pool and delete a pool

[root@e3 vmfs]# virsh pool-destroy disk01 #close pool destroy pool disk01[root@e3 vmfs]# virsh pool-list --all #view name state Automatic Start----------------------------------------- Inactive No vmdisk activities is [root@e3 vmfs]# virsh pool-undefined disk01 #Completely depooldisk01 has been dedefined [root@e3 vmfs]# virsh pool-list --all #View name state AutoStart----------------------------------------- activities is

Install virtual machines with created disks

[root@e3 ~]# virt-install --name centos66 --ram512--disk path=/data/kvm/vmfs/test.qcow2 --vcpus 2 --os-linux type--os-variant rhel6 --network bridge=br0 --graphics none --console pty,target_type=serial --location 'ftp://192.168.0.244/cdrom' --extra-args 'console=ttyS0,115200n8 serial' Start installation... Search for files.treeinfo...... | 590 B 00:00:00 !!! Search file vmlinuz...... | 7.9 MB 00:00:00 !!! Search for file initrd.img.... | 66 MB 00:00:00 !!! Create Domain... | 0 B 00:00:00 connect to domain centos66 escape symbol ^]#installation process previous article has

Delete VM Storage Volumes from Storage Pool

[root@e3 ~]# virsh pool-delete vmdisk test.qcow2 Thank you for reading this article carefully. I hope that the article "How to Implement KVM Virtualization Storage Pool" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support you more. Pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report