
virsh中的存储卷相关命令

5.4.2 显示池与卷的信息
#pool-list 帮助
[root@localhost storage]# virsh pool-list --help
NAME
pool-list - 列出池
SYNOPSIS
pool-list [--inactive] [--all] [--transient] [--persistent] [--autostart] [--no-autostart] [--type <string>] [--details]
DESCRIPTION
返回池列表
OPTIONS
--inactive
列出不活跃的池
--all
不活跃和活跃的池
--transient
列出临时池
--persistent
列出持久池
--autostart
列出启用 autostart 的池
--no-autostart 列出禁用 autostart 的池
--type <string> 只列出指定类型的池(如果支持)
--details
为池显示扩展的详情
#查看所有的存储池
[root@localhost storage]# virsh pool-list
setlocale: No such file or directory
Name
State
Autostart
-------------------------------------------
default
active
yes
iso
active
yes
VM
active
yes
#查看某个存储池的详细信息
[root@localhost storage]# virsh pool-info VM
setlocale: No such file or directory
Name:
VM
UUID:
8594b419-685a-477d-88bd-c8f1b057073e
State:
running
#存储池状态
Persistent:
yes
#是否是永久性存储池
Autostart:
yes
#是否随系统开机启动
Capacity:
39.24 GiB #总容量大小
Allocation:
6.97 GiB #已经分配容量
Available:
32.27 GiB #可用容量
#查看某个存储池中的所有存储卷
[root@localhost vm]# virsh vol-list VM
setlocale: No such file or directory
Name
Path
------------------------------------------------------------------------------
Base_CentOS6.5.qcow2 /vm/Base_CentOS6.5.qcow2
centos6.5-2.qcow2 /vm/centos6.5-2.qcow2
chensiqi.qcow2
/vm/chensiqi.qcow2
CRM-disk0.qcow2
/vm/CRM-disk0.qcow2
ERP-disk0.qcow2
/vm/ERP-disk0.qcow2
HR-disk0.qcow2
/vm/HR-disk0.qcow2
LNMP-disk1.qcow2
/vm/LNMP-disk1.qcow2
LNMP-disk1.vmdk
/vm/LNMP-disk1.vmdk
lost+found
/vm/lost+found
OA-disk0.qcow2
/vm/OA-disk0.qcow2
5.4.3 基于目录的存储池
[x] 准备目录
设置目录权限
# chown root:root /guest_images/
# chmod 700 /guest_images
[x] 通过virt-manager创建
[x] 通过virsh创建
# virsh pool-define-as guest_images dir --target "/guest_images2"

存储池实操:
#创建存储池目录
root@localhost ~]# mkdir /guest_images
[root@localhost ~]# chown root:root /guest_images
[root@localhost ~]# chmod 700 /guest_images/
(1)通过virt-manager创建存储池
