Unify guestfish and guestmount options processing (RHBZ#642932).
[libguestfs.git] / fuse / guestmount.pod
1 =encoding utf8
2
3 =head1 NAME
4
5 guestmount - Mount a guest filesystem on the host using FUSE and libguestfs
6
7 =head1 SYNOPSIS
8
9  guestmount [--options] -a disk.img -m device [--ro] mountpoint
10
11  guestmount [--options] -a disk.img -i [--ro] mountpoint
12
13  guestmount [--options] -d Guest -i [--ro] mountpoint
14
15 =head1 WARNING
16
17 You must I<not> use C<guestmount> in read-write mode on live virtual
18 machines.  If you do this, you risk disk corruption in the VM.
19
20 =head1 DESCRIPTION
21
22 The guestmount program can be used to mount virtual machine
23 filesystems and other disk images on the host.  It uses libguestfs for
24 access to the guest filesystem, and FUSE (the "filesystem in
25 userspace") to make it appear as a mountable device.
26
27 Along with other options, you have to give at least one device (I<-a>
28 option) or libvirt domain (I<-d> option), and at least one mountpoint
29 (I<-m> option) or use the I<-i> inspection option.  How this works is
30 better explained in the L<guestfish(1)> manual page, or by looking at
31 the examples below.
32
33 FUSE lets you mount filesystems as non-root.  The mountpoint must be
34 owned by you, and the filesystem will not be visible to any other
35 users unless you make certain global configuration changes to
36 C</etc/fuse.conf>.  To unmount the filesystem, use the C<fusermount -u>
37 command.
38
39 =head1 EXAMPLES
40
41 For a typical Windows guest which has its main filesystem on the
42 first partition:
43
44  guestmount -a windows.img -m /dev/sda1 --ro /mnt
45
46 For a typical Linux guest which has a /boot filesystem on the first
47 partition, and the root filesystem on a logical volume:
48
49  guestmount -a linux.img -m /dev/VG/LV -m /dev/sda1:/boot --ro /mnt
50
51 To get libguestfs to detect guest mountpoints for you:
52
53  guestmount -a guest.img -i --ro /mnt
54
55 For a libvirt guest called "Guest" you could do:
56
57  guestmount -d Guest -i --ro /mnt
58
59 If you don't know what filesystems are contained in a guest or
60 disk image, use L<virt-list-filesystems(1)> first:
61
62  virt-list-filesystems MyGuest
63
64 If you want to trace the libguestfs calls but without excessive
65 debugging information, we recommend:
66
67  guestmount [...] --trace /mnt
68
69 If you want to debug the program, we recommend:
70
71  guestmount [...] --trace --verbose /mnt
72
73 =head1 OPTIONS
74
75 =over 4
76
77 =item B<-a image> | B<--add image>
78
79 Add a block device or virtual machine image.
80
81 The format of the disk image is auto-detected.  To override this and
82 force a particular format use the I<--format=..> option.
83
84 =item B<-c URI> | B<--connect URI>
85
86 When used in conjunction with the I<-d> option, this specifies
87 the libvirt URI to use.  The default is to use the default libvirt
88 connection.
89
90 =item B<-d libvirt-domain> | B<--domain libvirt-domain>
91
92 Add disks from the named libvirt domain.  If the I<--ro> option is
93 also used, then any libvirt domain can be used.  However in write
94 mode, only libvirt domains which are shut down can be named here.
95
96 =item B<--dir-cache-timeout N>
97
98 Set the readdir cache timeout to I<N> seconds, the default being 60
99 seconds.  The readdir cache [actually, there are several
100 semi-independent caches] is populated after a readdir(2) call with the
101 stat and extended attributes of the files in the directory, in
102 anticipation that they will be requested soon after.
103
104 There is also a different attribute cache implemented by FUSE
105 (see the FUSE option I<-o attr_timeout>), but the FUSE cache
106 does not anticipate future requests, only cache existing ones.
107
108 =item B<--format=raw|qcow2|..> | B<--format>
109
110 The default for the I<-a> option is to auto-detect the format of the
111 disk image.  Using this forces the disk format for I<-a> options which
112 follow on the command line.  Using I<--format> with no argument
113 switches back to auto-detection for subsequent I<-a> options.
114
115 If you have untrusted raw-format guest disk images, you should use
116 this option to specify the disk format.  This avoids a possible
117 security problem with malicious guests (CVE-2010-3851).  See also
118 L<guestfs(3)/guestfs_add_drive_opts>.
119
120 =item B<--fuse-help>
121
122 Display help on special FUSE options (see I<-o> below).
123
124 =item B<--help>
125
126 Display brief help and exit.
127
128 =item B<-i> | B<--inspector>
129
130 Using L<virt-inspector(1)> code, inspect the disks looking for
131 an operating system and mount filesystems as they would be
132 mounted on the real virtual machine.
133
134 =item B<-m dev[:mnt]> | B<--mount dev[:mnt]>
135
136 Mount the named partition or logical volume on the given mountpoint
137 B<in the guest> (this has nothing to do with mountpoints in the host).
138
139 If the mountpoint is omitted, it defaults to C</>.  You have to mount
140 something on C</>.
141
142 =item B<-n> | B<--no-sync>
143
144 By default, we attempt to sync the guest disk when the FUSE mountpoint
145 is unmounted.  If you specify this option, then we don't attempt to
146 sync the disk.  See the discussion of autosync in the L<guestfs(3)>
147 manpage.
148
149 =item B<-o option> | B<--option option>
150
151 Pass extra options to FUSE.
152
153 To get a list of all the extra options supported by FUSE, use the
154 command below.  Note that only the FUSE I<-o> options can be passed,
155 and only some of them are a good idea.
156
157  guestmount --fuse-help
158
159 Some potentially useful FUSE options:
160
161 =over 4
162
163 =item B<-o allow_other>
164
165 Allow other users to see the filesystem.
166
167 =item B<-o attr_timeout=N>
168
169 Enable attribute caching by FUSE, and set the timeout to I<N> seconds.
170
171 =item B<-o kernel_cache>
172
173 Allow the kernel to cache files (reduces the number of reads
174 that have to go through the L<guestfs(3)> API).  This is generally
175 a good idea if you can afford the extra memory usage.
176
177 =item B<-o uid=N> B<-o gid=N>
178
179 Use these options to map all UIDs and GIDs inside the guest filesystem
180 to the chosen values.
181
182 =back
183
184 =item B<-r> | B<--ro>
185
186 Add devices and mount everything read-only.  Also disallow writes and
187 make the disk appear read-only to FUSE.
188
189 This is highly recommended if you are not going to edit the guest
190 disk.  If the guest is running and this option is I<not> supplied,
191 then there is a strong risk of disk corruption in the guest.  We try
192 to prevent this from happening, but it is not always possible.
193
194 =item B<--selinux>
195
196 Enable SELinux support for the guest.
197
198 =item B<-v> | B<--verbose>
199
200 Enable verbose messages from underlying libguestfs.
201
202 =item B<-V> | B<--version>
203
204 Display the program version and exit.
205
206 =item B<-x> | B<--trace>
207
208 Trace libguestfs calls.
209
210 This also stops the daemon from forking into the background.
211
212 =back
213
214 =head1 SEE ALSO
215
216 L<guestfish(1)>,
217 L<virt-inspector(1)>,
218 L<virt-cat(1)>,
219 L<virt-edit(1)>,
220 L<virt-tar(1)>,
221 L<guestfs(3)>,
222 L<http://libguestfs.org/>,
223 L<http://fuse.sf.net/>.
224
225 =head1 AUTHORS
226
227 Richard W.M. Jones (C<rjones at redhat dot com>)
228
229 =head1 COPYRIGHT
230
231 Copyright (C) 2009-2010 Red Hat Inc.
232 L<http://libguestfs.org/>
233
234 This program is free software; you can redistribute it and/or modify
235 it under the terms of the GNU General Public License as published by
236 the Free Software Foundation; either version 2 of the License, or
237 (at your option) any later version.
238
239 This program is distributed in the hope that it will be useful,
240 but WITHOUT ANY WARRANTY; without even the implied warranty of
241 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
242 GNU General Public License for more details.
243
244 You should have received a copy of the GNU General Public License
245 along with this program; if not, write to the Free Software
246 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.