guestunmount(1)

πŸ’… guestunmount(1) β€” the manual page bestie

okay so you're reading guestunmount(1) β€” that's the guestunmount manual page, living in the Virtualization Support section of your friendly neighbourhood man pages. Buckle up, this one's short and iconic ✨


🌸 NAME 🌸

guestunmount β€” unmount a guestmounted filesystem. that's it. that's the whole job. she's a cleanup queen πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

guestunmount mountpoint

guestunmount --fd=<FD> mountpoint

✨ DESCRIPTION ✨

so guestunmount is a utility that cleans up mounted filesystems automatically. guestmount(1) mounts filesystems using libguestfs, and then this little icon unmounts the filesystem once a program or script is done with it. very "i'll take it from here, bestie" of her 🫢

guestunmount is a wrapper around the FUSE fusermount(1) program, and that program must exist on the current PATH. no fusermount, no slay. 😭

there are two ways to use guestunmount. when you call it like:

guestunmount mountpoint

it unmounts mountpoint immediately. zero chill, instant cleanup. πŸ”₯

when you call it like:

guestunmount --fd=FD mountpoint

it waits until the pipe FD is closed. this is the sophisticated main-character mode: you use it to monitor another process and clean up its mountpoint when that process exits, exactly as described below. πŸ‘‘

πŸŽ€ FROM PROGRAMS πŸŽ€

you can just call guestunmount mountpoint from your program, but the 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. lowkey genius.

in your program, create a pipe (eg. by calling pipe(2)). let FD be the file descriptor number of the read side of the pipe (ie. pipefd[0]).

after mounting the filesystem with guestmount(1) (on 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. pipefd[1]) is closed for any reason β€” either explicitly or because the parent process exits β€” guestunmount notices and unmounts the mountpoint. no cap, she's watching πŸ‘€

if your operating system supports it, you should set the 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. fr fr, don't skip this one πŸ™ˆ

guestunmount never daemonizes itself. she stays present. she's not leaving the chat. πŸ’œ

🌈 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

one line, whole vibe handled. periodt. ⭐


πŸ’– OPTIONS πŸ’–

  • --fd=FD β€” specify the pipe file descriptor to monitor, and delay cleanup until that pipe is closed.
  • --help β€” display brief help and exit. short and sweet πŸ“
  • -q, --quiet β€” don't display error messages from fusermount. the return status is still set (see EXIT STATUS below), so you're not flying blind, just flying quiet 🀫
  • --no-retry, --retry=N β€” by default, guestunmount will retry the fusermount operation up to 5 times (that is, it will run it up to 6 times = 1 try + 5 retries).

use --no-retry to make guestunmount run fusermount only once.

use --retry=N to make guestunmount retry N times instead of 5.

guestunmount performs an exponential back-off between retries, waiting 1 second, 2 seconds, 4 seconds, etc before each retry. patient queen. she will wait for you 😌

  • -V, --version β€” display the program version and exit.

🧚 ENVIRONMENT VARIABLES 🧚

  • PATH β€” the fusermount(1) program (supplied by FUSE) must be available on the current PATH. if it's not on your PATH, she cannot find it, and that's a whole situation πŸ’€

πŸ‘‘ EXIT STATUS πŸ‘‘

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

  1. program error, eg. could not allocate memory, could not run fusermount. see the error message printed for more information.
  2. the mount point could not be unmounted even after retrying. see the error message printed for the underlying fusermount error.
  3. the mount point is not mounted.

🌸 SEE ALSO 🌸

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

go read the friends of the show, they're all iconic in their own right 🫢


πŸ’œ AUTHORS πŸ’œ

Richard W.M. Jones (rjones at redhat dot com) β€” the legend himself πŸ‘‘


Copyright (C) 2013 Red Hat Inc.


πŸ’… LICENSE πŸ’…

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

(yeah, the all-caps warranty disclaimer is giving serious energy, and you should take it seriously β€” it means what it says 😭)


πŸ› BUGS πŸ›

to get a list of bugs against libguestfs, use this link: https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Virtualization+Tools

to report a new bug against libguestfs, use this link: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools

when reporting a bug, please supply:

  • the version of libguestfs.
  • where you got libguestfs (eg. which Linux distro, compiled from source, etc)
  • describe the bug accurately and give a way to reproduce it.
  • run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report.
bestie please don't trim the output. unedited. complete. the maintainers are begging πŸ™

and that's the whole page, mwah πŸ’‹ this was libguestfs-1.61.3, dated 2026-09-16 β€” go unmount something responsibly, ily, bye! πŸ¦‹βœ¨

πŸ“¦ where this page comes from