定义存储池目录
[root@ddd-s-8 kvmimg]# virsh pool-define-as vmdisk --type dir --target /data/kvmimg/ Pool vmdisk defined 2.创建已定义的存储池 [root@ddd-s-8 kvmimg]# virsh pool-build vmdisk Pool vmdisk built
3.查看已定义的存储池,存储池不激活无法使用
[root@ddd-s-8 kvmimg]# virsh pool-list --all #查看所有存储池 Name State Autostart ----------------------------------------- default active yes vmdisk inactive no [root@ddd-s-8 kvmimg]# [root@ddd-s-8 kvmimg]# virsh pool-info vmdisk #查看vmdisk存储池信息 Name: vmdisk UUID: 6e80ce65-c13c-aac2-02fe-c370b6463109 State: inactive Persistent: yes Autostart: no
4.激活并自动启动已定义的存储池
[root@ddd-s-8 kvmimg]# virsh pool-autostart vmdisk Pool vmdisk marked as autostarted [root@ddd-s-8 kvmimg]# virsh pool-start vmdisk Pool vmdisk started [root@ddd-s-8 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 [root@ddd-s-8 kvmimg]# virsh pool-list --all Name State Autostart ----------------------------------------- default active yes vmdisk active yes
5.在存储池中创建qcow2虚拟机存储卷,之后就可以直接使用qcow2磁盘文件安装系统了
[root@ddd-s-8 kvmimg]# virsh vol-create-as vmdisk test06.qcow2 20G --format qcow2 Vol test06.qcow2 created 6.删除存储池命令整理 [root@ddd-s-8 kvmimg]# virsh vol-delete --pool vmdisk test06.qcow2 #删除刚刚创建的 Vol test06.qcow2 deleted [root@ddd-s-8 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 [root@ddd-s-8 kvmimg]# [root@ddd-s-8 kvmimg]# virsh pool-destroy vmdisk #取消激活存储池 [root@ddd-s-8 kvmimg]# virsh pool-delete vmdisk #删除存储池定义的目录/data/kvmimg [root@ddd-s-8 kvmimg]# virsh pool-undefine vmdisk #取消定义存储池
本文出自 “脚下的痕迹” 博客,请务必保留此出处http://dingmh.blog.51cto.com/188555/1435778
原文地址:http://dingmh.blog.51cto.com/188555/1435778