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