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       --blocksize=512
89       --blocksize=4096
90       --blocksize
91           This parameter sets the sector size of the disk image.  It affects
92           all explicitly added subsequent disks after this parameter.  Using
93           --blocksize with no argument switches the disk sector size to the
94           default value which is usually 512 bytes.  See also
95           "guestfs_add_drive_opts" in guestfs(3).
96
97       -c URI
98       --connect URI
99           If using libvirt, connect to the given URI.  If omitted, then we
100           connect to the default libvirt hypervisor.
101
102           If you specify guest block devices directly (-a), then libvirt is
103           not used at all.
104
105       --csv
106           Write out the results in CSV format (comma-separated values).  This
107           format can be imported easily into databases and spreadsheets, but
108           read "NOTE ABOUT CSV FORMAT" below.
109
110       -d guest
111       --domain guest
112           Add all the disks from the named libvirt guest.  Domain UUIDs can
113           be used instead of names.
114
115       --format=raw|qcow2|..
116       --format
117           The default for the -a option is to auto-detect the format of the
118           disk image.  Using this forces the disk format for -a options which
119           follow on the command line.  Using --format with no argument
120           switches back to auto-detection for subsequent -a options.
121
122           For example:
123
124            virt-df --format=raw -a disk.img
125
126           forces raw format (no auto-detection) for disk.img.
127
128            virt-df --format=raw -a disk.img --format -a another.img
129
130           forces raw format (no auto-detection) for disk.img and reverts to
131           auto-detection for another.img.
132
133           If you have untrusted raw-format guest disk images, you should use
134           this option to specify the disk format.  This avoids a possible
135           security problem with malicious guests (CVE-2010-3851).
136
137       -h
138       --human-readable
139           Print sizes in human-readable format.
140
141           You are not allowed to use -h and --csv at the same time.
142
143       -i
144       --inodes
145           Print inodes instead of blocks.
146
147       --one-per-guest
148           Since libguestfs 1.22, this is the default.  This option does
149           nothing and is left here for backwards compatibility with older
150           scripts.
151
152       -P nr_threads
153           Since libguestfs 1.22, virt-df is multithreaded and examines guests
154           in parallel.  By default the number of threads to use is chosen
155           based on the amount of free memory available at the time that virt-
156           df is started.  You can force virt-df to use at most "nr_threads"
157           by using the -P option.
158
159           Note that -P 0 means to autodetect, and -P 1 means to use a single
160           thread.
161
162       --uuid
163           Print UUIDs instead of names.  This is useful for following a guest
164           even when the guest is migrated or renamed, or when two guests
165           happen to have the same name.
166
167           Note that only domains that we fetch from libvirt come with UUIDs.
168           For disk images, we still print the disk image name even when this
169           option is specified.
170
171       -v
172       --verbose
173           Enable verbose messages for debugging.
174
175       -V
176       --version
177           Display version number and exit.
178
179       -x  Enable tracing of libguestfs API calls.
180

STATVFS NUMBERS

182       "virt-df" (and df(1)) get information by issuing a statvfs(3) system
183       call.  You can get the same information directly, either from the host
184       (using libguestfs) or inside the guest:
185
186       From the host
187           Run this command:
188
189            guestfish --ro -d GuestName -i statvfs /
190
191           (change / to see stats for other filesystems).
192
193       From inside the guest
194           Run this command:
195
196            python -c 'import os; s = os.statvfs ("/"); print s'
197
198           (change / to see stats for other filesystems).
199

NOTE ABOUT CSV FORMAT

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

EXIT STATUS

224       This program returns 0 if successful, or non-zero if there was an
225       error.
226

SEE ALSO

228       df(1), guestfs(3), guestfish(1), virt-filesystems(1),
229       http://libguestfs.org/.
230

AUTHOR

232       Richard W.M. Jones http://people.redhat.com/~rjones/
233
235       Copyright (C) 2009-2020 Red Hat Inc.
236

LICENSE

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

BUGS

253       To get a list of bugs against libguestfs, use this link:
254       https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
255
256       To report a new bug against libguestfs, use this link:
257       https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
258
259       When reporting a bug, please supply:
260
261       ·   The version of libguestfs.
262
263       ·   Where you got libguestfs (eg. which Linux distro, compiled from
264           source, etc)
265
266       ·   Describe the bug accurately and give a way to reproduce it.
267
268       ·   Run libguestfs-test-tool(1) and paste the complete, unedited output
269           into the bug report.
270
271
272
273libguestfs-1.42.0                 2020-03-09                        virt-df(1)
Impressum