码迷,mamicode.com
首页 > 其他好文 > 详细

KVM之virsh管理Storyage pool

时间:2019-06-28 18:01:00      阅读:211      评论:0      收藏:0      [点我收藏+]

标签:mdi   targe   city   容量   ext   管理   删除存储   path   状态   

创建基于文件夹的存储池

基于文件夹的存储池:

[root@ubuntu01 ~]# mkdir /data/vm_pool 
[root@ubuntu01 ~]# virsh pool-create-as --name vmdir_pool --type dir --target /data/vm_pool
Pool vmdir_pool created

基于文件夹的存储池:

[root@ubuntu01 ~]# mkdir /data/vmfs_pool  
[root@ubuntu01 ~]# virsh pool-create-as --name vmfs_pool --type fs --source-dev /dev/sdb1 --source-format ext4 --target /data/vmfs_pool
Pool vmfs_pool created

查看存储池状态


[root@ubuntu01 ~]# virsh pool-list --all 
 Name                 State      Autostart 
-------------------------------------------
 vmdir_pool           active     no        
 vmfs_pool            active     no  

[root@ubuntu01 ~]# virsh  pool-info vmdir_pool
Name:           vmdir_pool
UUID:           498b5826-f733-435c-ac73-b6fc33d04e58
State:          running
Persistent:     no
Autostart:      no
Capacity:       98.30 GiB
Allocation:     14.95 GiB
Available:      83.36 GiB

[root@ubuntu01 ~]# virsh  pool-info vmfs_pool 
Name:           vmfs_pool
UUID:           df740ec9-362f-4dea-98a6-cbd62c6e2887
State:          running
Persistent:     no
Autostart:      no
Capacity:       19.56 GiB
Allocation:     43.94 MiB
Available:      19.52 GiB

在存储池中创建卷

[root@ubuntu01 ~]# virsh vol-create-as --pool vmdir_pool --name vm_disk01.raw --capacity 10G --allocation 1G --format raw
Vol vm_disk01.raw created
  • --capacity 10G #总容量
  • --allocation 1G #初始大小

查看存储池的卷信息

[root@ubuntu01 ~]# virsh vol-list [--pool] vmdir_pool
 Name                 Path                                    
------------------------------------------------------------------------------
 vm_disk01.raw        /data/vm_pool/vm_disk01.raw             
 vm_disk02.raw        /data/vm_pool/vm_disk02.raw             

[root@ubuntu01 ~]# virsh vol-list [--pool] vmdir_pool --details
 Name           Path                         Type   Capacity  Allocation
-------------------------------------------------------------------------
 vm_disk01.raw  /data/vm_pool/vm_disk01.raw  file  10.00 GiB    1.00 GiB
 vm_disk02.raw  /data/vm_pool/vm_disk02.raw  file  10.00 GiB    1.00 GiB

[root@ubuntu01 ~]# ll /data/vm_pool/ -h 
total 1.1G
-rw------- 1 root root 10G Jun 28 14:06 vm_disk01.raw

[root@ubuntu01 ~]# virsh vol-info /data/vm_pool/vm_disk01.raw 
Name:           vm_disk01.raw
Type:           file
Capacity:       10.00 GiB
Allocation:     1.00 GiB

[root@ubuntu01 ~]# virsh vol-info [--vol] vm_disk01.raw --pool vmdir_pool
Name:           vm_disk01.raw
Type:           file
Capacity:       10.00 GiB
Allocation:     1.00 GiB

删除存储池

[root@ubuntu01 ~]# virsh pool-destroy vm_pool
Pool vm_pool destroyed

KVM之virsh管理Storyage pool

标签:mdi   targe   city   容量   ext   管理   删除存储   path   状态   

原文地址:https://www.cnblogs.com/wshenjin/p/11103945.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!