KVM Virtual machine-Storage pool configuration grooming (RPM)

Source: Internet
Author: User

1. Create a folder-based storage pool (directory)

2. Define the storage pool and its directory

1

# virsh pool-define-asvmdisk --type dir --target /data/vmfs

3. Create a defined storage pool (1) Create a defined storage pool

1

# virsh pool-build vmdisk

(2) To view the defined storage pool, the storage pool is not activated and cannot be used.

1

#virsh pool-list --all

4. Activating and automatically starting a defined storage pool

1

2

# virsh pool-autostart vmdisk

# virsh pool-start vmdisk

Here the Vmdisk storage pool has been created and you can create virtual disk files directly in this storage pool.

5. Create a virtual machine storage volume (1) in the storage pool create a virtual machine storage volume in the storage pool

1

# virsh vol-create-asvmdisk oeltest03.qcow2 20G --format qcow2

(2) Install the virtual machine based on the virtual machine storage volume created

1

virt-install --name=oeltest03 --os-variant=RHEL6 --ram 1024--vcpus=1 --disk path=/data/oeltest03.qcow2,format=qcow2,size=20,bus=virtio --accelerate --cdrom /data/iso/oel63x64.iso --vnc --vncport=5910 --vnclisten=0.0.0.0 --network bridge=br0,model=virtio –noautoconsole

The installation process is slightly

Note 1:KVM Storage pool is mainly a management mode, you can mount the storage directory, LVM logical volume to create a storage pool, virtual machine storage volume after the creation of the complete, the remaining operations and no storage volume of the way no difference.
Note 2:KVM storage pools are also used for virtual machine migration tasks.

6. Storage pool-related management commands (1) Create a virtual machine storage volume in a storage pool

1

# virsh vol-delete--pool vmdisk oeltest03.qcow2

(2) Deactivate storage pool

1

# virsh pool-destroy vmdisk

(3) Delete the directory defined by the storage pool/data/vmfs

1

# virsh pool-deletevmdisk

(4) To cancel the definition of a storage pool

1

# virsh pool-undefine vmdisk

To this KVM storage pool configuration and management operation is complete.

**********************************************************************************

Defining the Storage Pool directory
[Email protected] kvmimg]# virsh pool-define-as vmdisk--type dir--target/data/kvmimg/
Pool Vmdisk defined
2. Create a defined storage pool
[Email protected] kvmimg]# Virsh pool-build vmdisk
Pool Vmdisk built

3. View the defined storage pool, the storage pool is not activated and cannot be used

[Email protected] kvmimg]# Virsh pool-list--all #查看所有存储池
Name State Autostart
-----------------------------------------
Default Active Yes
Vmdisk Inactive No
[Email protected] kvmimg]#
[Email protected] kvmimg]# Virsh pool-info vmdisk #查看vmdisk存储池信息
Name:vmdisk
uuid:6e80ce65-c13c-aac2-02fe-c370b6463109
State:inactive
Persistent:yes
Autostart:no
4. Activating and automatically starting a defined storage pool
[Email protected] kvmimg]# Virsh Pool-autostart vmdisk
Pool Vmdisk marked as autostarted
[Email protected] kvmimg]# Virsh Pool-start vmdisk
Pool Vmdisk started
[Email protected] kvmimg]# Virsh pool-info vmdisk
Name:vmdisk
uuid:6e80ce65-c13c-aac2-02fe-c370b6463109
State:running
Persistent:yes
Autostart:yes
capacity:774.28 GiB
allocation:55.51 GiB
available:718.78 GiB
[Email protected] kvmimg]# Virsh pool-list--all
Name State Autostart
-----------------------------------------
Default Active Yes
Vmdisk Active Yes
5. Create the Qcow2 virtual machine storage volume in the storage pool, and then you can install the system directly using the Qcow2 disk file.
[Email protected] kvmimg]# Virsh vol-create-as vmdisk test06.qcow2 20G--format qcow2
Vol Test06.qcow2 Created
6. Delete Storage Pool command grooming
[Email protected] kvmimg]# Virsh vol-delete--pool vmdisk test06.qcow2 #删除刚刚创建的
Vol Test06.qcow2 deleted
[email protected] kvmimg]# LL
Total 56836660
-rw-r--r--1 root root 17911579136 Jul 7 18:27 test01.qcow2
-rw-r--r--1 root root 37823512576 Jul 7 15:31 test02.qcow2
-rwxr-xr-x 1 root root 17911578624 Jul 7 17:16 test03.qcow2
-rwxr-xr-x 1 root root 17911513088 Jul 7 17:20 test04.qcow2
-rw-r--r--1 root root 17911578624 Jul 7 20:45 test05.qcow2
[Email protected] kvmimg]#
[Email protected] kvmimg]# Virsh Pool-destroy vmdisk #取消激活存储池
[Email protected] kvmimg]# Virsh pool-delete vmdisk #删除存储池定义的目录/data/kvmimg
[Email protected] kvmimg]# Virsh pool-undefine vmdisk #取消定义存储池

KVM Virtual machine-Storage pool configuration grooming (RPM)

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.