12.3. 使用命令行查看虚拟机存储信息


使用命令行,您可以查看虚拟机可用的存储资源的详细信息。

流程

  1. 要查看主机上的可用存储池,请运行 virsh pool-list 命令,并带有列表所需的粒度选项。例如,以下选项显示有关主机上所有存储池的所有可用信息:

    # virsh pool-list --all --details
    
     Name                State    Autostart  Persistent    Capacity  Allocation   Available
     default             running  yes        yes          48.97 GiB   23.93 GiB   25.03 GiB
     Downloads           running  yes        yes         175.62 GiB   62.02 GiB  113.60 GiB
     RHEL-Storage-Pool   running  yes        yes         214.62 GiB   93.02 GiB  168.60 GiB
    Copy to Clipboard Toggle word wrap
    • 有关查看存储池信息的附加选项,请使用 virsh pool-list --help 命令。
  2. 要列出指定存储池中的存储卷,请使用 virsh vol-list 命令。

    # virsh vol-list --pool <RHEL-Storage-Pool> --details
     Name                Path                                               Type   Capacity  Allocation
    ---------------------------------------------------------------------------------------------
    
      RHEL_Volume.qcow2   /home/VirtualMachines/RHEL8_Volume.qcow2  file  60.00 GiB   13.93 GiB
    Copy to Clipboard Toggle word wrap
  3. 要查看附加到虚拟机的所有块设备,请使用 virsh domblklist 命令。

    # *virsh domblklist --details <vm-name>
    
     Type   Device   Target   Source
    -----------------------------------------------------------------------------
     file   disk     hda      /home/VirtualMachines/vm-name.qcow2
     file   cdrom    hdb      -
     file   disk     vdc      /home/VirtualMachines/test-disk2.qcow2
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat