File: guestunmount.pod

package info (click to toggle)
libguestfs 1%3A1.40.2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 123,660 kB
  • sloc: ansic: 460,074; ml: 63,059; sh: 14,955; java: 9,512; makefile: 9,133; cs: 6,300; haskell: 5,652; python: 3,856; perl: 3,619; erlang: 2,435; xml: 1,683; ruby: 350; pascal: 255; lex: 135; yacc: 128; cpp: 10
file content (155 lines) | stat: -rw-r--r-- 3,806 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

=head1 名前

guestunmount - Unmount a guestmounted filesystem

=head1 書式

 guestunmount mountpoint

 guestunmount --fd=<FD> mountpoint

=head1 説明

guestunmount is a utility to clean up mounted filesystems automatically.
L<guestmount(1)> mounts filesystems using libguestfs.  This program unmounts
the filesystem when a program or script has finished with it.

guestunmount is a wrapper around the FUSE L<fusermount(1)> program, which
must exist on the current C<PATH>.

There are two ways to use guestunmount.  When called as:

 guestunmount mountpoint

it unmounts C<mountpoint> immediately.

When called as:

 guestunmount --fd=FD mountpoint

it waits until the pipe C<FD> is closed.  This can be used to monitor
another process and clean up its mountpoint when that process exits, as
described below.

=head2 FROM PROGRAMS

You can just call C<guestunmount mountpoint> from the program, but a more
sophisticated way to use guestunmount is to have it monitor your program so
it can clean up the mount point if your program exits unexpectedly.

In the program, create a pipe (eg. by calling L<pipe(2)>).  Let C<FD> be the
file descriptor number of the read side of the pipe (ie. C<pipefd[0]>).

After mounting the filesystem with L<guestmount(1)> (on C<mountpoint>), fork
and run guestunmount like this:

 guestunmount --fd=FD mountpoint

Close the read side of the pipe in the parent process.

Now, when the write side of the pipe (ie. C<pipefd[1]>) is closed for any
reason, either explicitly or because the parent process exits, guestunmount
notices and unmounts the mountpoint.

If your operating system supports it, you should set the C<FD_CLOEXEC> flag
on the write side of the pipe.  This is so that other child processes don't
inherit the file descriptor and keep it open.

Guestunmount never daemonizes itself.

=head2 FROM SHELL SCRIPTS

Since bash doesn't provide a way to create an unnamed pipe, use a trap to
call guestunmount on exit like this:

 trap "guestunmount mountpoint" EXIT INT QUIT TERM

=head1 オプション

=over 4

=item B<--fd=FD>

Specify the pipe file descriptor to monitor, and delay cleanup until that
pipe is closed.

=item B<--help>

簡単なヘルプを表示して、終了します。

=item B<-q>

=item B<--quiet>

Don’t display error messages from fusermount.  The return status is still
set (see L</EXIT STATUS> below).

=item B<--no-retry>

=item B<--retry=N>

By default, guestunmount will retry the fusermount operation up to S<5
times> (that is, it will run it up to S<6 times> = S<1 try> + S<5 retries>).

Use I<--no-retry> to make guestunmount run fusermount only once.

Use I<--retry=N> to make guestunmount retry C<N> times instead of 5.

guestunmount performs an exponential back-off between retries, waiting S<1
second>, S<2 seconds>, S<4 seconds>, etc before each retry.

=item B<-V>

=item B<--version>

プログラムのバージョンを表示して、終了します。

=back

=head1 環境変数

=over 4

=item C<PATH>

The L<fusermount(1)> program (supplied by FUSE) must be available on the
current C<PATH>.

=back

=head1 終了ステータス

This program returns 0 if successful, or one of the following error codes:

=over 4

=item C<1>

Program error, eg. could not allocate memory, could not run fusermount.  See
the error message printed for more information.

=item C<2>

The mount point could not be unmounted even after retrying.  See the error
message printed for the underlying fusermount error.

=item C<3>

The mount point is not mounted.

=back

=head1 関連項目

L<guestmount(1)>, L<fusermount(1)>, L<pipe(2)>, L<guestfs(3)/MOUNT LOCAL>,
L<http://libguestfs.org/>, L<http://fuse.sf.net/>.

=head1 著者

Richard W.M. Jones (C<rjones at redhat dot com>)

=head1 COPYRIGHT

Copyright (C) 2013 Red Hat Inc.