1virt-filesystems(1) Virtualization Support virt-filesystems(1)
2
3
4
6 virt-filesystems - List filesystems, partitions, block devices, LVM in
7 a virtual machine or disk image
8
10 virt-filesystems [--options] -d domname
11
12 virt-filesystems [--options] -a disk.img [-a disk.img ...]
13
15 This tool allows you to discover filesystems, partitions, logical
16 volumes, and their sizes in a disk image or virtual machine. It is a
17 replacement for virt-list-filesystems(1) and virt-list-partitions(1).
18
19 One use for this tool is from shell scripts to iterate over all
20 filesystems from a disk image:
21
22 for fs in $(virt-filesystems -a disk.img); do
23 # ...
24 done
25
26 Another use is to list partitions before using another tool to modify
27 those partitions (such as virt-resize(1)). If you are curious about
28 what an unknown disk image contains, use this tool along with
29 virt-inspector(1).
30
31 Various command line options control what this program displays. You
32 need to give either -a or -d options to specify the disk image or
33 libvirt guest respectively. If you just specify that then the program
34 shows filesystems found, one per line, like this:
35
36 $ virt-filesystems -a disk.img
37 /dev/sda1
38 /dev/vg_guest/lv_root
39
40 If you add -l or --long then the output includes extra information:
41
42 $ virt-filesystems -a disk.img -l
43 Name Type VFS Label Size
44 /dev/sda1 filesystem ext4 boot 524288000
45 /dev/vg_guest/lv_root filesystem ext4 root 10212081664
46
47 If you add --extra then non-mountable (swap, unknown) filesystems are
48 shown as well:
49
50 $ virt-filesystems -a disk.img --extra
51 /dev/sda1
52 /dev/vg_guest/lv_root
53 /dev/vg_guest/lv_swap
54 /dev/vg_guest/lv_data
55
56 If you add --partitions then partitions are shown instead of
57 filesystems:
58
59 $ virt-filesystems -a disk.img --partitions
60 /dev/sda1
61 /dev/sda2
62
63 Similarly you can use --logical-volumes, --volume-groups,
64 --physical-volumes, --block-devices to list those items.
65
66 You can use these options in combination as well (if you want a
67 combination including filesystems, you have to add --filesystems).
68 Notice that some items fall into several categories (eg. /dev/sda1
69 might be both a partition and a filesystem). These items are listed
70 several times. To get a list which includes absolutely everything that
71 virt-filesystems knows about, use the --all option.
72
73 UUIDs (because they are quite long) are not shown by default. Add the
74 --uuid option to display device and filesystem UUIDs in the long
75 output.
76
77 --all --long --uuid is a useful combination to display all possible
78 information about everything.
79
80 $ virt-filesystems -a win.img --all --long --uuid -h
81 Name Type VFS Label Size Parent UUID
82 /dev/sda1 filesystem ntfs System Reserved 100M - F81C92571C92112C
83 /dev/sda2 filesystem ntfs - 20G - F2E8996AE8992E3B
84 /dev/sda1 partition - - 100M /dev/sda -
85 /dev/sda2 partition - - 20G /dev/sda -
86 /dev/sda device - - 20G - -
87
88 For machine-readable output, use --csv to get Comma-Separated Values.
89
91 --help
92 Display brief help.
93
94 -a file
95 --add file
96 Add file which should be a disk image from a virtual machine. If
97 the virtual machine has multiple block devices, you must supply all
98 of them with separate -a options.
99
100 The format of the disk image is auto-detected. To override this
101 and force a particular format use the --format=.. option.
102
103 -a URI
104 --add URI
105 Add a remote disk. See "ADDING REMOTE STORAGE" in guestfish(1).
106
107 --all
108 Display everything. This is currently the same as specifying these
109 options: --filesystems, --extra, --partitions, --block-devices,
110 --logical-volumes, --volume-groups, --physical-volumes. (More may
111 be added to this list in future).
112
113 See also --long.
114
115 --blkdevs
116 --block-devices
117 Display block devices.
118
119 --blocksize=512
120 --blocksize=4096
121 --blocksize
122 This parameter sets the sector size of the disk image. It affects
123 all explicitly added subsequent disks after this parameter. Using
124 --blocksize with no argument switches the disk sector size to the
125 default value which is usually 512 bytes. See also
126 "guestfs_add_drive_opts" in guestfs(3).
127
128 -c URI
129 --connect URI
130 If using libvirt, connect to the given URI. If omitted, then we
131 connect to the default libvirt hypervisor.
132
133 If you specify guest block devices directly (-a), then libvirt is
134 not used at all.
135
136 --csv
137 Write out the results in CSV format (comma-separated values). This
138 format can be imported easily into databases and spreadsheets, but
139 read "NOTE ABOUT CSV FORMAT" below.
140
141 -d guest
142 --domain guest
143 Add all the disks from the named libvirt guest. Domain UUIDs can
144 be used instead of names.
145
146 --echo-keys
147 When prompting for keys and passphrases, virt-filesystems normally
148 turns echoing off so you cannot see what you are typing. If you
149 are not worried about Tempest attacks and there is no one else in
150 the room you can specify this flag to see what you are typing.
151
152 --extra
153 This causes filesystems that are not ordinary, mountable
154 filesystems to be displayed. This category includes swapspace, and
155 filesystems that are empty or contain unknown data.
156
157 This option implies --filesystems.
158
159 --filesystems
160 Display mountable filesystems. If no display option was selected
161 then this option is implied.
162
163 With --extra, non-mountable filesystems are shown too.
164
165 --format=raw|qcow2|..
166 --format
167 The default for the -a option is to auto-detect the format of the
168 disk image. Using this forces the disk format for -a options which
169 follow on the command line. Using --format with no argument
170 switches back to auto-detection for subsequent -a options.
171
172 For example:
173
174 virt-filesystems --format=raw -a disk.img
175
176 forces raw format (no auto-detection) for disk.img.
177
178 virt-filesystems --format=raw -a disk.img --format -a another.img
179
180 forces raw format (no auto-detection) for disk.img and reverts to
181 auto-detection for another.img.
182
183 If you have untrusted raw-format guest disk images, you should use
184 this option to specify the disk format. This avoids a possible
185 security problem with malicious guests (CVE-2010-3851).
186
187 -h
188 --human-readable
189 In --long mode, display sizes in human-readable format.
190
191 --keys-from-stdin
192 Read key or passphrase parameters from stdin. The default is to
193 try to read passphrases from the user by opening /dev/tty.
194
195 -l
196 --long
197 Display extra columns of data ("long format").
198
199 A title row is added unless you also specify --no-title.
200
201 The extra columns displayed depend on what output you select, and
202 the ordering of columns may change in future versions. Use the
203 title row, --csv output and/or csvtool(1) to match columns to data
204 in external programs.
205
206 Use -h if you want sizes to be displayed in human-readable format.
207 The default is to show raw numbers of bytes.
208
209 Use --uuid to display UUIDs too.
210
211 --lvs
212 --logvols
213 --logical-volumes
214 Display LVM logical volumes. In this mode, these are displayed
215 irrespective of whether the LVs contain filesystems.
216
217 --no-title
218 In --long mode, don’t add a title row.
219
220 Note that the order of the columns is not fixed, and may change in
221 future versions of virt-filesystems, so using this option may give
222 you unexpected surprises.
223
224 --parts
225 --partitions
226 Display partitions. In this mode, these are displayed irrespective
227 of whether the partitions contain filesystems.
228
229 --pvs
230 --physvols
231 --physical-volumes
232 Display LVM physical volumes.
233
234 --uuid
235 --uuids
236 In --long mode, display UUIDs as well.
237
238 -v
239 --verbose
240 Enable verbose messages for debugging.
241
242 -V
243 --version
244 Display version number and exit.
245
246 --vgs
247 --volgroups
248 --volume-groups
249 Display LVM volume groups.
250
251 -x Enable tracing of libguestfs API calls.
252
254 Note that columns in the output are subject to reordering and change in
255 future versions of this tool.
256
257 Name
258 The filesystem, partition, block device or LVM name.
259
260 For device and partition names these are displayed as canonical
261 libguestfs names, so that for example /dev/sda2 is the second
262 partition on the first device.
263
264 If the --long option is not specified, then only the name column is
265 shown in the output.
266
267 Type
268 The object type, for example "filesystem", "lv", "device" etc.
269
270 VFS If there is a filesystem, then this column displays the filesystem
271 type if one could be detected, eg. "ext4".
272
273 Label
274 If the object has a label (used for identifying and mounting
275 filesystems) then this column contains the label.
276
277 MBR The partition type byte, displayed as a two digit hexadecimal
278 number. A comprehensive list of partition types can be found here:
279 http://www.win.tue.nl/~aeb/partitions/partition_types-1.html
280
281 This is only applicable for DOS (MBR) partitions.
282
283 Size
284 The size of the object in bytes. If the --human option is used
285 then the size is displayed in a human-readable form.
286
287 Parent
288 The parent column records the parent relationship between objects.
289
290 For example, if the object is a partition, then this column
291 contains the name of the containing device. If the object is a
292 logical volume, then this column is the name of the volume group.
293
294 If there is more than one parent, then this column is (internal to
295 the column) a comma-separated list, eg. "/dev/sda,/dev/sdb".
296
297 UUID
298 If the object has a UUID (used for identifying and mounting
299 filesystems and block devices) then this column contains the UUID
300 as a string.
301
302 The UUID is only displayed if the --uuid option is given.
303
305 Comma-separated values (CSV) is a deceptive format. It seems like it
306 should be easy to parse, but it is definitely not easy to parse.
307
308 Myth: Just split fields at commas. Reality: This does not work
309 reliably. This example has two columns:
310
311 "foo,bar",baz
312
313 Myth: Read the file one line at a time. Reality: This does not work
314 reliably. This example has one row:
315
316 "foo
317 bar",baz
318
319 For shell scripts, use "csvtool" (https://github.com/Chris00/ocaml-csv
320 also packaged in major Linux distributions).
321
322 For other languages, use a CSV processing library (eg. "Text::CSV" for
323 Perl or Python’s built-in csv library).
324
325 Most spreadsheets and databases can import CSV directly.
326
328 This program returns 0 if successful, or non-zero if there was an
329 error.
330
332 guestfs(3), guestfish(1), virt-cat(1), virt-df(1),
333 virt-list-filesystems(1), virt-list-partitions(1), csvtool(1),
334 http://libguestfs.org/.
335
337 Richard W.M. Jones http://people.redhat.com/~rjones/
338
340 Copyright (C) 2010-2012 Red Hat Inc.
341
343 This program is free software; you can redistribute it and/or modify it
344 under the terms of the GNU General Public License as published by the
345 Free Software Foundation; either version 2 of the License, or (at your
346 option) any later version.
347
348 This program is distributed in the hope that it will be useful, but
349 WITHOUT ANY WARRANTY; without even the implied warranty of
350 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
351 General Public License for more details.
352
353 You should have received a copy of the GNU General Public License along
354 with this program; if not, write to the Free Software Foundation, Inc.,
355 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
356
358 To get a list of bugs against libguestfs, use this link:
359 https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
360
361 To report a new bug against libguestfs, use this link:
362 https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
363
364 When reporting a bug, please supply:
365
366 · The version of libguestfs.
367
368 · Where you got libguestfs (eg. which Linux distro, compiled from
369 source, etc)
370
371 · Describe the bug accurately and give a way to reproduce it.
372
373 · Run libguestfs-test-tool(1) and paste the complete, unedited output
374 into the bug report.
375
376
377
378libguestfs-1.42.0 2020-03-09 virt-filesystems(1)