1virt-df(1)                  Virtualization Support                  virt-df(1)
2
3
4

NAME

6       virt-df - Display free space on virtual filesystems
7

SYNOPSIS

9       All guests:
10
11        virt-df [--options]
12
13       Single guest:
14
15        virt-df [--options] -d domname
16
17        virt-df [--options] -a disk.img [-a disk.img ...]
18
19       Old style:
20
21        virt-df [--options] domname
22
23        virt-df [--options] disk.img [disk.img ...]
24

DESCRIPTION

26       "virt-df" is a command line tool to display free space on virtual
27       machine filesystems.  Unlike other tools, it doesn't just display the
28       size of disk allocated to a virtual machine, but can look inside disk
29       images to see how much space is really being used.
30
31       If used without any -a or -d arguments, "virt-df" checks with libvirt
32       to get a list of all active and inactive guests, and performs a
33       "df"-type operation on each one in turn, printing out the results.
34
35       If any -a or -d arguments are specified, "virt-df" performs a "df"-type
36       operation on either the single named libvirt domain, or on the disk
37       image(s) listed on the command line (which must all belong to a single
38       VM).  In this mode (with arguments), "virt-df" will only work for a
39       single guest.  If you want to run on multiple guests, then you have to
40       invoke "virt-df" multiple times.
41
42       Use the --csv option to get a format which can be easily parsed by
43       other programs.  Other options are similar to the standard df(1)
44       command.
45

EXAMPLES

47       Show disk usage for a single libvirt guest called "F14x64".  Make the
48       output human-readable:
49
50        # virt-df -d F14x64 -h
51        Filesystem                       Size     Used  Available  Use%
52        F14x64:/dev/sda1                 484M      66M       393M   14%
53        F14x64:/dev/vg_f13x64/lv_root    7.4G     3.4G       4.0G   46%
54
55       Show disk usage for a disk image file called test.img:
56
57        $ virt-df -a test1.img
58        Filesystem                  1K-blocks     Used  Available  Use%
59        test1.img:/dev/sda1             99099     1551      92432    2%
60
61       If a single guest has multiple disks, use the -a option repeatedly.  A
62       plus sign ("+") is displayed for each additional disk.  Note: Do not do
63       this with unrelated guest disks.
64
65        $ virt-df -a Win7x32TwoDisks-a -a Win7x32TwoDisks-b
66        Filesystem                   1K-blocks    Used  Available  Use%
67        Win7x32TwoDisks-a+:/dev/sda1    102396   24712      77684   25%
68        Win7x32TwoDisks-a+:/dev/sda2  12478460 7403416    5075044   60%
69        Win7x32TwoDisks-a+:/dev/sdb1    521212   55728     465484   11%
70

OPTIONS

72       --help
73           Display brief help.
74
75       -a FILE
76       --add FILE
77           Add "FILE" which should be a disk image from a virtual machine.  If
78           the virtual machine has multiple block devices, you must supply all
79           of them with separate -a options.
80
81           The format of the disk image is auto-detected.  To override this
82           and force a particular format use the --format=.. option.
83
84       -a URI
85       --add URI
86           Add a remote disk.  See "ADDING REMOTE STORAGE" in guestfish(1).
87
88       -c URI
89       --connect URI
90           If using libvirt, connect to the given URI.  If omitted, then we
91           connect to the default libvirt hypervisor.
92
93           If you specify guest block devices directly (-a), then libvirt is
94           not used at all.
95
96       --csv
97           Write out the results in CSV format (comma-separated values).  This
98           format can be imported easily into databases and spreadsheets, but
99           read "NOTE ABOUT CSV FORMAT" below.
100
101       -d guest
102       --domain guest
103           Add all the disks from the named libvirt guest.  Domain UUIDs can
104           be used instead of names.
105
106       --format=raw|qcow2|..
107       --format
108           The default for the -a option is to auto-detect the format of the
109           disk image.  Using this forces the disk format for -a options which
110           follow on the command line.  Using --format with no argument
111           switches back to auto-detection for subsequent -a options.
112
113           For example:
114
115            virt-df --format=raw -a disk.img
116
117           forces raw format (no auto-detection) for disk.img.
118
119            virt-df --format=raw -a disk.img --format -a another.img
120
121           forces raw format (no auto-detection) for disk.img and reverts to
122           auto-detection for another.img.
123
124           If you have untrusted raw-format guest disk images, you should use
125           this option to specify the disk format.  This avoids a possible
126           security problem with malicious guests (CVE-2010-3851).
127
128       -h
129       --human-readable
130           Print sizes in human-readable format.
131
132           You are not allowed to use -h and --csv at the same time.
133
134       -i
135       --inodes
136           Print inodes instead of blocks.
137
138       --one-per-guest
139           Since libguestfs 1.22, this is the default.  This option does
140           nothing and is left here for backwards compatibility with older
141           scripts.
142
143       -P nr_threads
144           Since libguestfs 1.22, virt-df is multithreaded and examines guests
145           in parallel.  By default the number of threads to use is chosen
146           based on the amount of free memory available at the time that virt-
147           df is started.  You can force virt-df to use at most "nr_threads"
148           by using the -P option.
149
150           Note that -P 0 means to autodetect, and -P 1 means to use a single
151           thread.
152
153       --uuid
154           Print UUIDs instead of names.  This is useful for following a guest
155           even when the guest is migrated or renamed, or when two guests
156           happen to have the same name.
157
158           Note that only domains that we fetch from libvirt come with UUIDs.
159           For disk images, we still print the disk image name even when this
160           option is specified.
161
162       -v
163       --verbose
164           Enable verbose messages for debugging.
165
166       -V
167       --version
168           Display version number and exit.
169
170       -x  Enable tracing of libguestfs API calls.
171

STATVFS NUMBERS

173       "virt-df" (and df(1)) get information by issuing a statvfs(3) system
174       call.  You can get the same information directly, either from the host
175       (using libguestfs) or inside the guest:
176
177       From the host
178           Run this command:
179
180            guestfish --ro -d GuestName -i statvfs /
181
182           (change / to see stats for other filesystems).
183
184       From inside the guest
185           Run this command:
186
187            python -c 'import os; s = os.statvfs ("/"); print s'
188
189           (change / to see stats for other filesystems).
190

NOTE ABOUT CSV FORMAT

192       Comma-separated values (CSV) is a deceptive format.  It seems like it
193       should be easy to parse, but it is definitely not easy to parse.
194
195       Myth: Just split fields at commas.  Reality: This does not work
196       reliably.  This example has two columns:
197
198        "foo,bar",baz
199
200       Myth: Read the file one line at a time.  Reality: This does not work
201       reliably.  This example has one row:
202
203        "foo
204        bar",baz
205
206       For shell scripts, use "csvtool" (https://github.com/Chris00/ocaml-csv
207       also packaged in major Linux distributions).
208
209       For other languages, use a CSV processing library (eg. "Text::CSV" for
210       Perl or Python’s built-in csv library).
211
212       Most spreadsheets and databases can import CSV directly.
213

EXIT STATUS

215       This program returns 0 if successful, or non-zero if there was an
216       error.
217

SEE ALSO

219       df(1), guestfs(3), guestfish(1), virt-filesystems(1),
220       http://libguestfs.org/.
221

AUTHOR

223       Richard W.M. Jones http://people.redhat.com/~rjones/
224
226       Copyright (C) 2009-2018 Red Hat Inc.
227

LICENSE

229       This program is free software; you can redistribute it and/or modify it
230       under the terms of the GNU General Public License as published by the
231       Free Software Foundation; either version 2 of the License, or (at your
232       option) any later version.
233
234       This program is distributed in the hope that it will be useful, but
235       WITHOUT ANY WARRANTY; without even the implied warranty of
236       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
237       General Public License for more details.
238
239       You should have received a copy of the GNU General Public License along
240       with this program; if not, write to the Free Software Foundation, Inc.,
241       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
242

BUGS

244       To get a list of bugs against libguestfs, use this link:
245       https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
246
247       To report a new bug against libguestfs, use this link:
248       https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
249
250       When reporting a bug, please supply:
251
252       ·   The version of libguestfs.
253
254       ·   Where you got libguestfs (eg. which Linux distro, compiled from
255           source, etc)
256
257       ·   Describe the bug accurately and give a way to reproduce it.
258
259       ·   Run libguestfs-test-tool(1) and paste the complete, unedited output
260           into the bug report.
261
262
263
264libguestfs-1.38.2                 2018-05-15                        virt-df(1)
Impressum