主要参考了man page

virt-filesystems

列出在虚机或磁盘镜像里的文件系统、分区、块设备、LVM

virt-filesystems - List filesystems, partitions, block devices, LVM in a virtual machine or disk p_w_picpath

 

-a:后接磁盘镜像

[root@cloudmanager datapool]# virt-filesystems -a centos56x64

/dev/sda1

/dev/vmvg/root

 

[root@cloudmanager datapool]# virt-filesystems -a win2003ent32chs 

/dev/sda1

 

[root@cloudmanager datapool]# virt-filesystems -a win2008ent64chs 

/dev/sda1

 

--extra:If you add --extra then non-mountable (swap, unknown) filesystems are shown as well:

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --extra

/dev/sda1

/dev/vmvg/root

/dev/vmvg/swap

 

-l:输出额外的一些分区信息,包括分区的size,label,vfs,type

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 -l

Name            Type        VFS   Label  Size

/dev/sda1       filesystem  ext3  /boot  205599744

/dev/vmvg/root  filesystem  ext3  -      6207569920

 

-d:后面接的是libvirt的domain,就是虚机名

[root@cloudmanager datapool]# virt-filesystems -d nagios -l

Name            Type        VFS   Label  Size

/dev/sda1       filesystem  ext3  /boot  205599744

/dev/vmvg/root  filesystem  ext3  -      102844334080

 

--partitions:只列出分区,不会列出已经被格式化的文件系统

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --partitions

/dev/sda1

/dev/sda2

 

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --partitions -l

Name       Type       MBR  Size         Parent

/dev/sda1  partition  83   205599744    /dev/sda

/dev/sda2  partition  8e   10528358400  /dev/sda

 

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --partitions -l --extra

Name            Type        VFS   Label  MBR  Size         Parent

/dev/sda1       filesystem  ext3  /boot  -    205599744    -

/dev/vmvg/root  filesystem  ext3  -      -    6207569920   -

/dev/vmvg/swap  filesystem  swap  -      -    4294967296   -

/dev/sda1       partition   -     -      83   205599744    /dev/sda

/dev/sda2       partition   -     -      8e   10528358400  /dev/sda

 

--logical-volumes:列出LV卷(lvs)

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --logical-volumes

/dev/vmvg/root

/dev/vmvg/swap

 

--volume-groups:列出VG卷(vgs)

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --volume-groups

/dev/vmvg

 

--physical-volues:列出PV卷(pvs)

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --physical-volumes

/dev/sda2

 

--block-devices:列出块设备

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --block-devices

/dev/sda

 

--filesystems:列出文件系统

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --filesystems

/dev/sda1

/dev/vmvg/root

 

--all:列出所有,包括块,文件系统,lv等信息

-h:以M或者G显示大小

--uuid:列出设备的uuid

 

[root@cloudmanager datapool]# virt-filesystems -a centos56x64 --all --long --uuid -h

Name           Type       VFS  Label MBR Size Parent    UUID

/dev/sda1      filesystem ext3 /boot -   196M -         0b99a0f7-3de3-45c4-b727-e95e3065c13c

/dev/vmvg/root filesystem ext3 -     -   5.8G -         bdc72bb0-10a0-4474-88ac-a3aa7721c57a

/dev/vmvg/swap filesystem swap -     -   4.0G -         -

/dev/vmvg/root lv         -    -     -   5.8G /dev/vmvg yDdq8b-lVnl-AlfE-Fv5Y-3MSH-LPPk-saJT0e

/dev/vmvg/swap lv         -    -     -   4.0G /dev/vmvg LFCUEO-e3kG-X4U8-Ct7B-Vo13-asjH-frG2wY

/dev/vmvg      vg         -    -     -   9.8G -         JPyRfgZllBPoGOCwfibE7KRn0c9QmM1G

/dev/sda2      pv         -    -     -   9.8G -         u1MI25SdKPhvKTyc9YFpOI9vrNxKaumz

/dev/sda1      partition  -    -     83  196M /dev/sda  -

/dev/sda2      partition  -    -     8e  9.8G /dev/sda  -

/dev/sda       device     -    -     -   10G  -         -

 

 

--format:强制更改镜像的格式

[root@cloudmanager datapool]# virt-filesystems --format=raw -a centos56x64

 

-V:输出版本信息

-v:输出debug信息

-x:输出trace的信息

SEE ALSO

       guestfs(3), guestfish(1), virt-cat(1), virt-df(1), virt-list-filesystems(1), virt-list-partitions(1), csvtool(1), <http://libguestfs.org/>.