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 If there are multiple encrypted devices then you may need to supply
196 multiple keys on stdin, one per line.
197
198 -l
199 --long
200 Display extra columns of data ("long format").
201
202 A title row is added unless you also specify --no-title.
203
204 The extra columns displayed depend on what output you select, and
205 the ordering of columns may change in future versions. Use the
206 title row, --csv output and/or csvtool(1) to match columns to data
207 in external programs.
208
209 Use -h if you want sizes to be displayed in human-readable format.
210 The default is to show raw numbers of bytes.
211
212 Use --uuid to display UUIDs too.
213
214 --lvs
215 --logvols
216 --logical-volumes
217 Display LVM logical volumes. In this mode, these are displayed
218 irrespective of whether the LVs contain filesystems.
219
220 --no-title
221 In --long mode, don’t add a title row.
222
223 Note that the order of the columns is not fixed, and may change in
224 future versions of virt-filesystems, so using this option may give
225 you unexpected surprises.
226
227 --parts
228 --partitions
229 Display partitions. In this mode, these are displayed irrespective
230 of whether the partitions contain filesystems.
231
232 --pvs
233 --physvols
234 --physical-volumes
235 Display LVM physical volumes.
236
237 --uuid
238 --uuids
239 In --long mode, display UUIDs as well.
240
241 -v
242 --verbose
243 Enable verbose messages for debugging.
244
245 -V
246 --version
247 Display version number and exit.
248
249 --vgs
250 --volgroups
251 --volume-groups
252 Display LVM volume groups.
253
254 -x Enable tracing of libguestfs API calls.
255
257 Note that columns in the output are subject to reordering and change in
258 future versions of this tool.
259
260 Name
261 The filesystem, partition, block device or LVM name.
262
263 For device and partition names these are displayed as canonical
264 libguestfs names, so that for example /dev/sda2 is the second
265 partition on the first device.
266
267 If the --long option is not specified, then only the name column is
268 shown in the output.
269
270 Type
271 The object type, for example "filesystem", "lv", "device" etc.
272
273 VFS If there is a filesystem, then this column displays the filesystem
274 type if one could be detected, eg. "ext4".
275
276 Label
277 If the object has a label (used for identifying and mounting
278 filesystems) then this column contains the label.
279
280 MBR The partition type byte, displayed as a two digit hexadecimal
281 number. A comprehensive list of partition types can be found here:
282 http://www.win.tue.nl/~aeb/partitions/partition_types-1.html
283
284 This is only applicable for DOS (MBR) partitions.
285
286 Size
287 The size of the object in bytes. If the --human option is used
288 then the size is displayed in a human-readable form.
289
290 Parent
291 The parent column records the parent relationship between objects.
292
293 For example, if the object is a partition, then this column
294 contains the name of the containing device. If the object is a
295 logical volume, then this column is the name of the volume group.
296
297 If there is more than one parent, then this column is (internal to
298 the column) a comma-separated list, eg. "/dev/sda,/dev/sdb".
299
300 UUID
301 If the object has a UUID (used for identifying and mounting
302 filesystems and block devices) then this column contains the UUID
303 as a string.
304
305 The UUID is only displayed if the --uuid option is given.
306
308 Comma-separated values (CSV) is a deceptive format. It seems like it
309 should be easy to parse, but it is definitely not easy to parse.
310
311 Myth: Just split fields at commas. Reality: This does not work
312 reliably. This example has two columns:
313
314 "foo,bar",baz
315
316 Myth: Read the file one line at a time. Reality: This does not work
317 reliably. This example has one row:
318
319 "foo
320 bar",baz
321
322 For shell scripts, use "csvtool" (https://github.com/Chris00/ocaml-csv
323 also packaged in major Linux distributions).
324
325 For other languages, use a CSV processing library (eg. "Text::CSV" for
326 Perl or Python’s built-in csv library).
327
328 Most spreadsheets and databases can import CSV directly.
329
331 This program returns 0 if successful, or non-zero if there was an
332 error.
333
335 guestfs(3), guestfish(1), virt-cat(1), virt-df(1),
336 virt-list-filesystems(1), virt-list-partitions(1), csvtool(1),
337 http://libguestfs.org/.
338
340 Richard W.M. Jones http://people.redhat.com/~rjones/
341
343 Copyright (C) 2010-2012 Red Hat Inc.
344
346 This program is free software; you can redistribute it and/or modify it
347 under the terms of the GNU General Public License as published by the
348 Free Software Foundation; either version 2 of the License, or (at your
349 option) any later version.
350
351 This program is distributed in the hope that it will be useful, but
352 WITHOUT ANY WARRANTY; without even the implied warranty of
353 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
354 General Public License for more details.
355
356 You should have received a copy of the GNU General Public License along
357 with this program; if not, write to the Free Software Foundation, Inc.,
358 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
359
361 To get a list of bugs against libguestfs, use this link:
362 https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
363
364 To report a new bug against libguestfs, use this link:
365 https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
366
367 When reporting a bug, please supply:
368
369 • The version of libguestfs.
370
371 • Where you got libguestfs (eg. which Linux distro, compiled from
372 source, etc)
373
374 • Describe the bug accurately and give a way to reproduce it.
375
376 • Run libguestfs-test-tool(1) and paste the complete, unedited output
377 into the bug report.
378
379
380
381guestfs-tools-1.48.2 2022-05-26 virt-filesystems(1)