virt-df

Langue: en

Autres versions - même langue

Version: 2010-09-20 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)

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.

You are not allowed to use -h and --csv at the same time.

--inodes | -i
Print inodes instead of blocks.
--one-per-guest
Run one libguestfs appliance per guest. Normally "virt-df" will add the disks from several guests to a single libguestfs appliance.

You might use this option in the following circumstances:

*
If you think an untrusted guest might actively try to exploit the libguestfs appliance kernel, then this prevents one guest from interfering with the stats printed for another guest.
*
If the kernel has a bug which stops it from accessing a filesystem in one guest (see for example RHBZ#635373) then this allows libguestfs to continue and report stats for further guests.

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), Sys::Guestfs(3), Sys::Guestfs::Lib(3), Sys::Virt(3), <http://libguestfs.org/>.

AUTHOR

Richard W.M. Jones <http://people.redhat.com/~rjones/> Copyright (C) 2009-2010 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.