Restructure library for dealing with block mappings.
[virt-df.git] / virt-df / virt-df.txt
1 NAME
2     virt-df - 'df'-like utility for virtualization stats
3
4 SUMMARY
5     virt-df [-options]
6
7 DESCRIPTION
8     virt-df is a df(1)-like utility for showing the actual disk usage of
9     guests. Many command line options are the same as for ordinary *df*.
10
11     It uses libvirt so it is capable of showing stats across a variety of
12     different virtualization systems.
13
14     There are some shortcomings to the whole approach of reading disk state
15     from outside the guest. Please read SHORTCOMINGS section below for more
16     details.
17
18 OPTIONS
19     -a, --all
20         Show all domains. The default is show only running (active) domains.
21
22     -c uri, --connect uri
23         Connect to libvirt URI. The default is to connect to the default
24         libvirt URI, normally Xen.
25
26     --csv
27         Print the results in CSV format, suitable for importing into a
28         spreadsheet or database.
29
30         This option is only supported if virt-df was built with CSV support.
31
32     --debug
33         Emit debugging information on stderr. Please supply this if you
34         report a bug.
35
36     -h, --human-readable
37         Display human-readable sizes (eg. 10GiB).
38
39     -i, --inodes
40         Display inode information.
41
42     --help
43         Display usage summary.
44
45     -t diskimage
46         Test mode. Instead of checking libvirt for domain information, this
47         runs virt-df directly on the disk image (or device) supplied. You
48         may specify the -t option multiple times.
49
50     --version
51         Display version and exit.
52
53 SHORTCOMINGS
54     virt-df spies on the guest's disk image to try to work out how much disk
55     space it is actually using. There are some shortcomings to this,
56     described here.
57
58     (1) It does not work over remote connections. The storage API does not
59     support peeking into remote disks, and libvirt has rejected a request to
60     add this support.
61
62     (2) It only understands a limited set of partition types. Assuming that
63     the files and partitions that we get back from libvirt / Xen correspond
64     to block devices in the guests, we can go some way towards manually
65     parsing those partitions to find out what they contain. We can read the
66     MBR, LVM, superblocks and so on. However that's a lot of parsing work,
67     and currently there is no library which understands a wide range of
68     partition schemes and filesystem types (not even libparted which doesn't
69     support LVM yet). The Linux kernel does support that, but there's not
70     really any good way to access that work.
71
72     The current implementation uses a hand-coded parser which understands
73     some simple formats (MBR, LVM2, ext2/3). In future we should use
74     something like libparted.
75
76     (3) The statistics you get are delayed. The real state of, for example,
77     an ext2 filesystem is only stored in the memory of the guest's kernel.
78     The ext2 superblock contains some meta-information about blocks used and
79     free, but this superblock is not up to date. In fact the guest kernel
80     may not update it even on a 'sync', not until the filesystem is
81     unmounted. Some operations do appear to write the superblock, for
82     example fsync(2) [that is my reading of the ext2/3 source code at
83     least].
84
85 SECURITY
86     The current code tries hard to be secure against malicious guests, for
87     example guests which set up malicious disk partitions.
88
89 SEE ALSO
90     df(1), virsh(1), xm(1), <http://www.libvirt.org/ocaml/>,
91     <http://www.libvirt.org/>, <http://et.redhat.com/~rjones/>,
92     <http://caml.inria.fr/>
93
94 AUTHORS
95     Richard W.M. Jones <rjones @ redhat . com>
96
97 COPYRIGHT
98     (C) Copyright 2007-2008 Red Hat Inc., Richard W.M. Jones
99     http://libvirt.org/
100
101     This program is free software; you can redistribute it and/or modify it
102     under the terms of the GNU General Public License as published by the
103     Free Software Foundation; either version 2 of the License, or (at your
104     option) any later version.
105
106     This program is distributed in the hope that it will be useful, but
107     WITHOUT ANY WARRANTY; without even the implied warranty of
108     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
109     Public License for more details.
110
111     You should have received a copy of the GNU General Public License along
112     with this program; if not, write to the Free Software Foundation, Inc.,
113     675 Mass Ave, Cambridge, MA 02139, USA.
114
115 REPORTING BUGS
116     Bugs can be viewed on the Red Hat Bugzilla page:
117     <https://bugzilla.redhat.com/>.
118
119     If you find a bug in virt-df, please follow these steps to report it:
120
121     1. Check for existing bug reports
122         Go to <https://bugzilla.redhat.com/> and search for similar bugs.
123         Someone may already have reported the same bug, and they may even
124         have fixed it.
125
126     2. Capture debug and error messages
127         Run
128
129          virt-df --debug > virt-df.log 2>&1
130
131         and keep *virt-df.log*. It contains error messages which you should
132         submit with your bug report.
133
134     3. Get version of virt-df and version of libvirt.
135         Run
136
137          virt-df --version
138
139     4. Submit a bug report.
140         Go to <https://bugzilla.redhat.com/> and enter a new bug. Please
141         describe the problem in as much detail as possible.
142
143         Remember to include the version numbers (step 3) and the debug
144         messages file (step 2).
145
146     5. Assign the bug to rjones @ redhat.com
147         Assign or reassign the bug to rjones @ redhat.com (without the
148         spaces). You can also send me an email with the bug number if you
149         want a faster response.
150