umount(2) System Calls Manual umount(2) umount, umount2 - Standard C library (libc, -lc) #include int umount(const char *target); int umount2(const char *target, int flags); umount() umount2() ( ) , target. (Linux: CAP_SYS_ADMIN). Linux 2.1.116 umount2(), , umount(), , flags, : MNT_FORCE ( Linux 2.1.116) . , . , . Linux 4.12 MNT_FORCE : 9p ( Linux 2.6.16), ceph ( Linux 2.6.34), cifs ( Linux 2.6.12), fuse ( Linux 2.6.16), lustre ( Linux 3.11) NFS ( Linux 2.1.116). MNT_DETACH ( Linux 2.4.11) Perform a lazy unmount: make the mount unavailable for new accesses, immediately disconnect the filesystem and all filesystems mounted below it from each other and from the mount table, and actually perform the unmount when the mount ceases to be busy. MNT_EXPIRE ( Linux 2.6.8) Mark the mount as expired. If a mount is not currently in use, then an initial call to umount2() with this flag fails with the error EAGAIN, but marks the mount as expired. The mount remains expired as long as it isn't accessed by any process. A second umount2() call specifying MNT_EXPIRE unmounts an expired mount. This flag cannot be specified with either MNT_FORCE or MNT_DETACH. UMOUNT_NOFOLLOW ( Linux 2.6.34) , target . root set-user-ID, . 0. -1, errno . , , . . Linux. EAGAIN umount2() MNT_EXPIRE . EBUSY target , . EFAULT target , . EINVAL target . EINVAL target is locked; see mount_namespaces(7). EINVAL umount2() MNT_EXPIRE MNT_DETACH MNT_FORCE. EINVAL ( Linux 2.6.34) umount2() flags. ENAMETOOLONG MAXPATHLEN. ENOENT . ENOMEM . EPERM . Linux. MNT_DETACH and MNT_EXPIRE are available since glibc 2.11. umount() umount(device) ENOTBLK . Linux 0.98p4 umount(dir) . Linux 2.3.99-pre7 umount(device), umount(dir) ( , ). umount() and shared mounts Shared mounts cause any mount activity on a mount, including umount() operations, to be forwarded to every shared mount in the peer group and every slave mount of that peer group. This means that umount() of any peer in a set of shared mounts will cause all of its peers to be unmounted and all of their slaves to be unmounted as well. This propagation of unmount activity can be particularly surprising on systems where every mount is shared by default. On such systems, recursively bind mounting the root directory of the filesystem onto a subdirectory and then later unmounting that subdirectory with MNT_DETACH will cause every mount in the mount namespace to be lazily unmounted. To ensure umount() does not propagate in this fashion, the mount may be remounted using a mount(2) call with a mount_flags argument that includes both MS_REC and MS_PRIVATE prior to umount() being called. mount(2), mount_namespaces(7), path_resolution(7), mount(8), umount(8) () Azamat Hackimov , Dmitriy Ovchinnikov , Dmitry Bolkhovskikh , Katrin Kutepova , Yuri Kozlov , Kirill Rekhov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux man-pages 6.12 23 2024 . umount(2)