标签:des style io ar color os sp for strong
创建基于文件夹(目录)的存储池
1、定义存储池vmware_pool
virsh pool-define-as vmware_pool --type dir --target /etc/libvirt/storage
创建存储池vmware_pool,类型为文件目录,/virhost/vmware,与pool-define-as结果一样
virsh pool-create-as --name vmware_pool --type dir --target /etc/libvirt/storage
查看存储池信息
root@ubuntu:~# virsh pool-info vmware_pool Name: vmware_pool UUID: 8e3f7b0f-1492-4163-9cb9-962b5c8fd79c State: running Persistent: yes Autostart: no Capacity: 138.52 GiB Allocation: 70.34 GiB Available: 68.18 GiB
启动存储池
virsh pool-start vmware_pool
销毁存储域,取消存储池
virsh pool-destroy vmware_pool #销毁存储池
virsh pool-undefine vmware_pool #取消存储池的定义
2、创建了存储池后,就可以创建一个卷,这个卷是用来做虚拟机的硬盘
virsh vol-create-as --pool vmware_pool --name test11.img --capacity 10G --allocation 1G --format qcow2
创建卷 node6.img,所在存储池为vmware_pool,容量10G,初始分配1G,文件格式类型qcow2
查看存储卷信息
root@ubuntu:~# virsh vol-info /etc/libvirt/storage/test11.img Name: test11.img Type: file Capacity: 10.00 GiB Allocation: 136.00 KiB
给虚拟机挂载存储卷
virsh attach-disk test2 /etc/libvirt/storage/test11.img vdb
查看虚拟机test2是否挂载存储卷成功
root@ubuntu:~# virsh domblklist test2 Target Source ------------------------------------------------ hda /var/instances/test2.img hdc - vdb /etc/libvirt/storage/test11.img
将卷从虚拟机上分离
root@ubuntu:~# virsh detach-disk test2 /etc/libvirt/storage/test11.img Disk detached successfully
root@ubuntu:~# virsh domblklist test2 Target Source ------------------------------------------------ hda /var/instances/test2.img hdc -
标签:des style io ar color os sp for strong
原文地址:http://my.oschina.net/GavinYin/blog/351432