1guestunmount(1)             Virtualization Support             guestunmount(1)
2
3
4

NAME

6       guestunmount - Unmount a guestmounted filesystem
7

SYNOPSIS

9        guestunmount mountpoint
10
11        guestunmount --fd=<FD> mountpoint
12

DESCRIPTION

14       guestunmount is a utility to clean up mounted filesystems
15       automatically.  guestmount(1) mounts filesystems using libguestfs.
16       This program unmounts the filesystem when a program or script has
17       finished with it.
18
19       guestunmount is a wrapper around the FUSE fusermount(1) program, which
20       must exist on the current "PATH".
21
22       There are two ways to use guestunmount.  When called as:
23
24        guestunmount mountpoint
25
26       it unmounts "mountpoint" immediately.
27
28       When called as:
29
30        guestunmount --fd=FD mountpoint
31
32       it waits until the pipe "FD" is closed.  This can be used to monitor
33       another process and clean up its mountpoint when that process exits, as
34       described below.
35
36   FROM PROGRAMS
37       You can just call "guestunmount mountpoint" from the program, but a
38       more sophisticated way to use guestunmount is to have it monitor your
39       program so it can clean up the mount point if your program exits
40       unexpectedly.
41
42       In the program, create a pipe (eg. by calling pipe(2)).  Let "FD" be
43       the file descriptor number of the read side of the pipe (ie.
44       "pipefd[0]").
45
46       After mounting the filesystem with guestmount(1) (on "mountpoint"),
47       fork and run guestunmount like this:
48
49        guestunmount --fd=FD mountpoint
50
51       Close the read side of the pipe in the parent process.
52
53       Now, when the write side of the pipe (ie. "pipefd[1]") is closed for
54       any reason, either explicitly or because the parent process exits,
55       guestunmount notices and unmounts the mountpoint.
56
57       If your operating system supports it, you should set the "FD_CLOEXEC"
58       flag on the write side of the pipe.  This is so that other child
59       processes don't inherit the file descriptor and keep it open.
60
61       Guestunmount never daemonizes itself.
62
63   FROM SHELL SCRIPTS
64       Since bash doesn't provide a way to create an unnamed pipe, use a trap
65       to call guestunmount on exit like this:
66
67        trap "guestunmount mountpoint" EXIT INT QUIT TERM
68

OPTIONS

70       --fd=FD
71           Specify the pipe file descriptor to monitor, and delay cleanup
72           until that pipe is closed.
73
74       --help
75           Display brief help and exit.
76
77       -q
78       --quiet
79           Don’t display error messages from fusermount.  The return status is
80           still set (see "EXIT STATUS" below).
81
82       --no-retry
83       --retry=N
84           By default, guestunmount will retry the fusermount operation up to
85           5 times (that is, it will run it up to 6 times = 1 try +
86           5 retries).
87
88           Use --no-retry to make guestunmount run fusermount only once.
89
90           Use --retry=N to make guestunmount retry "N" times instead of 5.
91
92           guestunmount performs an exponential back-off between retries,
93           waiting 1 second, 2 seconds, 4 seconds, etc before each retry.
94
95       -V
96       --version
97           Display the program version and exit.
98

ENVIRONMENT VARIABLES

100       "PATH"
101           The fusermount(1) program (supplied by FUSE) must be available on
102           the current "PATH".
103

EXIT STATUS

105       This program returns 0 if successful, or one of the following error
106       codes:
107
108       1   Program error, eg. could not allocate memory, could not run
109           fusermount.  See the error message printed for more information.
110
111       2   The mount point could not be unmounted even after retrying.  See
112           the error message printed for the underlying fusermount error.
113
114       3   The mount point is not mounted.
115

SEE ALSO

117       guestmount(1), fusermount(1), pipe(2), "MOUNT LOCAL" in guestfs(3),
118       http://libguestfs.org/, http://fuse.sf.net/.
119

AUTHORS

121       Richard W.M. Jones ("rjones at redhat dot com")
122
124       Copyright (C) 2013 Red Hat Inc.
125

LICENSE

127       This program is free software; you can redistribute it and/or modify it
128       under the terms of the GNU General Public License as published by the
129       Free Software Foundation; either version 2 of the License, or (at your
130       option) any later version.
131
132       This program is distributed in the hope that it will be useful, but
133       WITHOUT ANY WARRANTY; without even the implied warranty of
134       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
135       General Public License for more details.
136
137       You should have received a copy of the GNU General Public License along
138       with this program; if not, write to the Free Software Foundation, Inc.,
139       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
140

BUGS

142       To get a list of bugs against libguestfs, use this link:
143       https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools
144
145       To report a new bug against libguestfs, use this link:
146       https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
147
148       When reporting a bug, please supply:
149
150       •   The version of libguestfs.
151
152       •   Where you got libguestfs (eg. which Linux distro, compiled from
153           source, etc)
154
155       •   Describe the bug accurately and give a way to reproduce it.
156
157       •   Run libguestfs-test-tool(1) and paste the complete, unedited output
158           into the bug report.
159
160
161
162libguestfs-1.51.9                 2023-12-09                   guestunmount(1)
Impressum