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 --all
104 Display everything. This is currently the same as specifying these
105 options: --filesystems, --extra, --partitions, --block-devices,
106 --logical-volumes, --volume-groups, --physical-volumes. (More may
107 be added to this list in future).
108
109 See also --long.
110
111 --blkdevs
112 --block-devices
113 Display block devices.
114
115 -c URI
116 --connect URI
117 If using libvirt, connect to the given URI. If omitted, then we
118 connect to the default libvirt hypervisor.
119
120 If you specify guest block devices directly (-a), then libvirt is
121 not used at all.
122
123 --csv
124 Write out the results in CSV format (comma-separated values). This
125 format can be imported easily into databases and spreadsheets, but
126 read "NOTE ABOUT CSV FORMAT" below.
127
128 -d guest
129 --domain guest
130 Add all the disks from the named libvirt guest.
131
132 --echo-keys
133 When prompting for keys and passphrases, virt-filesystems normally
134 turns echoing off so you cannot see what you are typing. If you
135 are not worried about Tempest attacks and there is no one else in
136 the room you can specify this flag to see what you are typing.
137
138 --extra
139 This causes filesystems that are not ordinary, mountable
140 filesystems to be displayed. This category includes swapspace, and
141 filesystems that are empty or contain unknown data.
142
143 This option implies --filesystems.
144
145 --filesystems
146 Display mountable filesystems. If no display option was selected
147 then this option is implied.
148
149 With --extra, non-mountable filesystems are shown too.
150
151 --format=raw|qcow2|..
152 --format
153 The default for the -a option is to auto-detect the format of the
154 disk image. Using this forces the disk format for -a options which
155 follow on the command line. Using --format with no argument
156 switches back to auto-detection for subsequent -a options.
157
158 For example:
159
160 virt-filesystems --format=raw -a disk.img
161
162 forces raw format (no auto-detection) for "disk.img".
163
164 virt-filesystems --format=raw -a disk.img --format -a another.img
165
166 forces raw format (no auto-detection) for "disk.img" and reverts to
167 auto-detection for "another.img".
168
169 If you have untrusted raw-format guest disk images, you should use
170 this option to specify the disk format. This avoids a possible
171 security problem with malicious guests (CVE-2010-3851).
172
173 -h
174 --human-readable
175 In --long mode, display sizes in human-readable format.
176
177 --keys-from-stdin
178 Read key or passphrase parameters from stdin. The default is to
179 try to read passphrases from the user by opening "/dev/tty".
180
181 -l
182 --long
183 Display extra columns of data ("long format").
184
185 A title row is added unless you also specify --no-title.
186
187 The extra columns displayed depend on what output you select, and
188 the ordering of columns may change in future versions. Use the
189 title row, --csv output and/or csvtool(1) to match columns to data
190 in external programs.
191
192 Use -h if you want sizes to be displayed in human-readable format.
193 The default is to show raw numbers of bytes.
194
195 Use --uuid to display UUIDs too.
196
197 --lvs
198 --logvols
199 --logical-volumes
200 Display LVM logical volumes. In this mode, these are displayed
201 irrespective of whether the LVs contain filesystems.
202
203 --no-title
204 In --long mode, don't add a title row.
205
206 Note that the order of the columns is not fixed, and may change in
207 future versions of virt-filesystems, so using this option may give
208 you unexpected surprises.
209
210 --parts
211 --partitions
212 Display partitions. In this mode, these are displayed irrespective
213 of whether the partitions contain filesystems.
214
215 --pvs
216 --physvols
217 --physical-volumes
218 Display LVM physical volumes.
219
220 --uuid
221 --uuids
222 In --long mode, display UUIDs as well.
223
224 -v
225 --verbose
226 Enable verbose messages for debugging.
227
228 -V
229 --version
230 Display version number and exit.
231
232 --vgs
233 --volgroups
234 --volume-groups
235 Display LVM volume groups.
236
237 -x Enable tracing of libguestfs API calls.
238
240 Note that columns in the output are subject to reordering and change in
241 future versions of this tool.
242
243 Name
244 The filesystem, partition, block device or LVM name.
245
246 For device and partition names these are displayed as canonical
247 libguestfs names, so that for example "/dev/sda2" is the second
248 partition on the first device.
249
250 If the --long option is not specified, then only the name column is
251 shown in the output.
252
253 Type
254 The object type, for example "filesystem", "lv", "device" etc.
255
256 VFS If there is a filesystem, then this column displays the filesystem
257 type if one could be detected, eg. "ext4".
258
259 Label
260 If the object has a label (used for identifying and mounting
261 filesystems) then this column contains the label.
262
263 Size
264 The size of the object in bytes. If the --human option is used
265 then the size is displayed in a human-readable form.
266
267 Parent
268 The parent column records the parent relationship between objects.
269 For example, if the object is a partition, then this column
270 contains the name of the containing device. If the object is a
271 logical volume, then this column is the name of the volume group.
272
273 UUID
274 If the object has a UUID (used for identifying and mounting
275 filesystems and block devices) then this column contains the UUID
276 as a string.
277
278 The UUID is only displayed if the --uuid option is given.
279
281 Comma-separated values (CSV) is a deceptive format. It seems like it
282 should be easy to parse, but it is definitely not easy to parse.
283
284 Myth: Just split fields at commas. Reality: This does not work
285 reliably. This example has two columns:
286
287 "foo,bar",baz
288
289 Myth: Read the file one line at a time. Reality: This does not work
290 reliably. This example has one row:
291
292 "foo
293 bar",baz
294
295 For shell scripts, use "csvtool" (<http://merjis.com/developers/csv>
296 also packaged in major Linux distributions).
297
298 For other languages, use a CSV processing library (eg. "Text::CSV" for
299 Perl or Python's built-in csv library).
300
301 Most spreadsheets and databases can import CSV directly.
302
304 Libvirt guest names can contain arbitrary characters, some of which
305 have meaning to the shell such as "#" and space. You may need to quote
306 or escape these characters on the command line. See the shell manual
307 page sh(1) for details.
308
310 guestfs(3), guestfish(1), virt-cat(1), virt-df(1),
311 virt-list-filesystems(1), virt-list-partitions(1), csvtool(1),
312 <http://libguestfs.org/>.
313
315 Richard W.M. Jones <http://people.redhat.com/~rjones/>
316
318 Copyright (C) 2010 Red Hat Inc.
319
320 This program is free software; you can redistribute it and/or modify it
321 under the terms of the GNU General Public License as published by the
322 Free Software Foundation; either version 2 of the License, or (at your
323 option) any later version.
324
325 This program is distributed in the hope that it will be useful, but
326 WITHOUT ANY WARRANTY; without even the implied warranty of
327 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
328 General Public License for more details.
329
330 You should have received a copy of the GNU General Public License along
331 with this program; if not, write to the Free Software Foundation, Inc.,
332 675 Mass Ave, Cambridge, MA 02139, USA.
333
334
335
336libguestfs-1.8.15 2011-11-10 virt-filesystems(1)