Define the storage pool directory
[[Email protected] kvmimg] # virsh pool-define-as vmdisk -- type dir -- target/data/kvmimg/pool vmdisk defined2. create a defined storage pool [[email protected] kvmimg] # virsh pool-build vmdiskpool vmdisk built
3. view the defined storage pool. The storage pool cannot be used if it is not activated.
[[Email protected] kvmimg] # virsh pool-list -- all # view all storage pool names autostart defaults active Yes vmdisk inactive no [[email protected] kvmimg] # [email protected] kvmimg] # virsh pool-Info vmdisk # view vmdisk storage pool information Name: vmdiskuuid: 6e80ce65-c13c-aac2-02fe-c370b64631_state: inactivepersistent: yesautostart: No
4. Activate and automatically start the defined storage pool
[[email protected] kvmimg]# virsh pool-autostart vmdiskPool vmdisk marked as autostarted[[email protected] kvmimg]# virsh pool-start vmdiskPool vmdisk started[[email protected] kvmimg]# virsh pool-info vmdisk Name: vmdiskUUID: 6e80ce65-c13c-aac2-02fe-c370b6463109State: runningPersistent: yesAutostart: yesCapacity: 774.28 GiBAllocation: 55.51 GiBAvailable: 718.78 GiB[[email protected] kvmimg]# virsh pool-list --all Name State Autostart -----------------------------------------default active yes vmdisk active yes
5. Create a qcow2 VM storage volume in the storage pool, and then you can directly use the qcow2 disk file to install the system.
[[Email protected] kvmimg] # virsh vol-create-as vmdisk test06.qcow2 20g -- format qcow2 vol test06.qcow2 created6. Delete storage pool command to organize [[email protected] kvmimg] # virsh vol- delete -- pool vmdisk test06.qcow2 # Delete the created vol test06.qcow2 deleted [[email protected] kvmimg] # lltotal deleted -- r -- 1 Root 17911579136 Jul 7 test01.qcow2-RW-r -- r -- 1 Root 37823512576 Jul 7 test02.qcow2-rwxr-XR-x 1 Root 17911578624 Jul 7 test03.qcow2-rwxr-XR-x 1 Root 17911513088 Jul 7 test04.qcow2-RW- r -- 1 Root 17911578624 Jul 7 test05.qcow2 [[email protected] kvmimg] # [[email protected] kvmimg] # virsh pool-destroy vmdisk # cancel the activation of the storage pool [[ email protected] kvmimg] # virsh pool-delete vmdisk # Delete the directory defined by the storage pool/data/kvmimg [[email protected] kvmimg] # virsh pool-undefine vmdisk # cancel the definition of the storage pool
This article from the "feet of traces" blog, please be sure to keep this source http://dingmh.blog.51cto.com/188555/1435778