通过virt-manager删除存储池
[root@localhost ~]# virsh pool-list --all setlocale: No such file or directory Name State Autostart ------------------------------------------- default active yes guest_images_dir inactive yes #状态变成了不活跃 iso active yes VM active yes [root@localhost ~]# virsh pool-list --all setlocale: No such file or directory Name State Autostart ------------------------------------------- default active yes iso active yes VM active yes [root@localhost ~]# ls /etc/libvirt/storage/ VM.xml autostart default.xml iso.xml(2)通过virsh创建一个自定义存储池
#定义一个存储池 [root@localhost ~]# virsh pool-define --help setlocale: No such file or directory NAME pool-define - define an inactive persistent storage pool or modify an existing persistent one from an XML file SYNOPSIS pool-define <file> #如果直接去定义存储池参数比较多,我们可以选择直接通过存储池的配置文件去定义存储池 DESCRIPTION Define or modify a persistent storage pool. OPTIONS [--file] <string> file containing an XML pool description [root@localhost ~]# virsh pool-define-as guest_images dir --target "/guest_images2" #guest_images存储池名字,target目标路径 Pool guest_images defined [root@localhost ~]# virsh pool-list --all setlocale: No such file or directory Name State Autostart ------------------------------------------- default active yes guest_images inactive no #新定义的存储池并没有启动 iso active yes VM active yes [root@localhost ~]# virsh pool-start guest_images #启动存储池 error: Failed to start pool guest_images #启动失败 error: cannot open directory \'/guest_images2\': 没有那个文件或目录 #我们不要用手动去创建存储池目录,因为可能会有权限问题。 #创建一个定义好的存储池的存储目录 root@localhost ~]# virsh pool-build guest_images Pool guest_images built [root@localhost ~]# ll -d /gue* drws--S--- 2 root root 6 May 6 16:25 /guest_images drwxr-xr-x 2 root root 6 May 11 10:55 /guest_images2 [root@localhost ~]# virsh pool-start guest_images #启动存储池 Pool guest_images started [root@localhost ~]# virsh pool-list --all setlocale: No such file or directory Name State Autostart ------------------------------------------- default active yes guest_images active no #存储池处于启动状态 iso active yes VM active yes [root@localhost ~]# virsh pool-autostart guest_images #标记存储池自动启动 setlocale: No such file or directory Pool guest_images marked as autostarted [root@localhost ~]# virsh pool-list --all setlocale: No such file or directory Name State Autostart ------------------------------------------- default active yes guest_images active yes iso active yes VM active yes