NAME

virt-df - Display free space on virtual filesystems


SYNOPSIS

 virt-df [--options]
 virt-df [--options] domname
 virt-df [--options] disk.img [disk.img ...]


DESCRIPTION

virt-df is a command line tool to display free space on virtual machine filesystems. Unlike other tools, it doesn't just display the amount of space allocated to a virtual machine, but can look inside the virtual machine to see how much space is really being used.

It is like the df(1) command, but for virtual machines, except that it also works for Windows virtual machines.

If used without any arguments, virt-df checks with libvirt to get a list of all active and inactive guests, and performs a df-type operation on each one in turn, printing out the results.

If used with any argument(s), virt-df performs a df-type operation on either the single named libvirt domain, or on the disk image(s) listed on the command line (which must all belong to a single VM). In this mode (with arguments), virt-df will only work for a single guest. If you want to run on multiple guests, then you have to invoke virt-df multiple times.

Use the --csv option to get a format which can be easily parsed by other programs. Other options are mostly similar to standard df options. See below for the complete list.


OPTIONS

--help

Display brief help.

--version

Display version number and exit.

--connect URI | -c URI

If using libvirt, connect to the given URI. If omitted, then we connect to the default libvirt hypervisor.

If you specify guest block devices directly, then libvirt is not used at all.

--csv

Write out the results in CSV format (comma-separated values). This format can be imported easily into databases and spreadsheets, but read NOTE ABOUT CSV FORMAT below.

--human-readable | -h

Print sizes in human-readable format.

--inodes | -i

Print inodes instead of blocks.


NOTE ABOUT CSV FORMAT

Comma-separated values (CSV) is a deceptive format. It seems like it should be easy to parse, but it is definitely not easy to parse.

Myth: Just split fields at commas. Reality: This does not work reliably. This example has two columns:

 "foo,bar",baz

Myth: Read the file one line at a time. Reality: This does not work reliably. This example has one row:

 "foo
 bar",baz

For shell scripts, use csvtool (http://merjis.com/developers/csv also packaged in major Linux distributions).

For other languages, use a CSV processing library (eg. Text::CSV for Perl or Python's built-in csv library).

Most spreadsheets and databases can import CSV directly.


SEE ALSO

guestfs(3), guestfish(1), the Sys::Guestfs(3) manpage, the Sys::Guestfs::Lib(3) manpage, the Sys::Virt(3) manpage, http://libguestfs.org/.


AUTHOR

Richard W.M. Jones http://et.redhat.com/~rjones/


COPYRIGHT

Copyright (C) 2009 Red Hat Inc.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.