.\" Copyright (C) 1993 Rickard E. Faith .\" and Copyright (C) 1994 Andries E. Brouwer .\" and Copyright (C) 2002, 2005 Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" 2008-10-06, mtk: Created this as a new page by splitting .\" umount/umount2 material out of mount.2 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2008 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2008-11-20, Akihiro MOTOKI , LDP v3.13 .\" Updated 2012-04-30, Akihiro MOTOKI .\" .TH UMOUNT 2 2020\-06\-09 Linux "Linux Programmer's Manual" .SH 名前 umount, umount2 \- ファイルシステムをアンマウントする .SH 書式 .nf \fB#include \fP .PP \fBint umount(const char *\fP\fItarget\fP\fB);\fP .PP \fBint umount2(const char *\fP\fItarget\fP\fB, int \fP\fIflags\fP\fB);\fP .fi .SH 説明 .\" Note: the kernel naming differs from the glibc naming .\" umount2 is the glibc name for what the kernel now calls umount .\" and umount is the glibc name for oldumount \fBumount\fP() と \fBumount2\fP() は \fItarget\fP にマウントされている (最上位の) ファイルシステムを外す。 .PP ファイルシステムのアンマウントを行うには、 適切な権限 (Linux では \fBCAP_SYS_ADMIN\fP ケーパビリティ) が必要である。 .PP Linux 2.1.116 から、 \fBumount2\fP() システムコールが追加された。これは \fBumount\fP() と同様に \fItarget\fP をアンマウントするが、 \fIflags\fP が追加されており、操作時の振る舞いを制御できる。 .TP \fBMNT_FORCE\fP (2.1.116 以降) Ask the filesystem to abort pending requests before attempting the unmount. This may allow the unmount to complete without waiting for an inaccessible server, but could cause data loss. If, after aborting requests, some processes still have active references to the filesystem, the unmount will still fail. As at Linux 4.12, \fBMNT_FORCE\fP is supported only on the following filesystems: 9p (since Linux 2.6.16), ceph (since Linux 2.6.34), cifs (since Linux 2.6.12), fuse (since Linux 2.6.16), lustre (since Linux 3.11), and NFS (since Linux 2.1.116). .TP \fBMNT_DETACH\fP (2.4.11 以降) Perform a lazy unmount: make the mount point 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 point ceases to be busy. .TP \fBMNT_EXPIRE\fP (Linux 2.6.8 以降) マウントポイントに期限切れの印をつける。 マウントポイントが現在使用中でない場合、このフラグをつけて \fBumount2\fP() を初めて呼び出すと \fBEAGAIN\fP エラーで失敗するが、マウントポイントには期限切れ (expire) の印がつけられる。 そのマウントポイントはいずれかのプロセスがアクセスしない限り 期限切れの印がついたままとなる。 もう一度 \fBMNT_EXPIRE\fP をつけて \fBumount2\fP() を呼び出すと、期限切れの印のついたマウントポイントが アンマウントされる。 このフラグを \fBMNT_FORCE\fP もしくは \fBMNT_DETACH\fP と同時に指定することはできない。 .TP \fBUMOUNT_NOFOLLOW\fP (Linux 2.6.34 以降) .\" Later added to 2.6.33-stable \fItarget\fP がシンボリックリンクの場合に、シンボリックリンクの展開を行わない。 このフラグを使うと、 \fIroot\fP に set\-user\-ID されたプログラムにおいて、 非特権ユーザーがファイルシステムのアンマウントをできてしまうという セキュリティ問題を回避することができる。 .SH 返り値 成功した場合、0 が返される。 失敗した場合、 \-1 が返され、 \fIerrno\fP に適切な値がセットされる。 .SH エラー 以下に示すエラーは、ファイルシステムに依存しないものである。 それぞれのファイルシステムタイプには固有のエラーが存在する場合があり、 独自の動作をすることもある。詳しくは Linux カーネルのソースを見て欲しい。 .TP \fBEAGAIN\fP \fBMNT_EXPIRE\fP を指定した \fBumount2\fP() の呼び出しで、正常に未使用のファイルシステムに期限切れの印を つけることができた。 .TP \fBEBUSY\fP 使用中 (busy) のため、 \fItarget\fP をアンマウントできなかった。 .TP \fBEFAULT\fP \fItarget\fP がユーザーアドレス空間の外を指している。 .TP \fBEINVAL\fP \fItarget\fP がマウントポイントではない。 .TP \fBEINVAL\fP \fBMNT_EXPIRE\fP が指定された \fBumount2\fP() で、 \fBMNT_DETACH\fP か \fBMNT_FORCE\fP が同時に指定された。 .TP \fBEINVAL\fP (Linux 2.6.34 以降) \fIflags\fP に無効なフラグが指定されて \fBumount2\fP() が呼び出された。 .TP \fBENAMETOOLONG\fP パス名の長さが \fBMAXPATHLEN\fP より長かった。 .TP \fBENOENT\fP パス名が空である。もしくは指定されたパスが存在しない。 .TP \fBENOMEM\fP カーネルがファイル名やデータをコピーするための空きページを確保できなかった。 .TP \fBEPERM\fP 呼び出し元が必要な権限を持っていない。 .SH バージョン .\" http://sourceware.org/bugzilla/show_bug.cgi?id=10092 \fBMNT_DETACH\fP と \fBMNT_EXPIRE\fP はバージョン 2.11 以降の glibc で利用できる。 .SH 準拠 この関数は Linux 固有の関数であり、移植を考慮したプログラムでは 使用すべきでない。 .SH 注意 .SS "umount() and shared mount points" Shared mount points cause any mount activity on a mount point, including \fBumount\fP() operations, to be forwarded to every shared mount point in the peer group and every slave mount of that peer group. This means that \fBumount\fP() 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. .PP This propagation of unmount activity can be particularly surprising on systems where every mount point 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 \fBMNT_DETACH\fP will cause every mount in the mount namespace to be lazily unmounted. .PP To ensure \fBumount\fP() does not propagate in this fashion, the mount point may be remounted using a \fBmount\fP(2) call with a \fImount_flags\fP argument that includes both \fBMS_REC\fP and \fBMS_PRIVATE\fP prior to \fBumount\fP() being called. .SS "Historical details" 元々の \fBumount\fP() 関数は \fIumount(device)\fP の形で呼び出され、 ブロックデバイス以外を指定して呼び出すと \fBENOTBLK\fP を返した。 Linux 0.98p4 で、無名デバイス (anonymous device) に対応するために \fIumount(dir)\fP の形での呼び出しが加えられた。 Linux 2.3.99\-pre7 で、\fIumount(device)\fP は削除され、 \fIumount(dir)\fP だけが残された (一つのデバイスを複数の位置にマウント出来るようになったため、 デバイスを指定しただけでは不十分だからである)。 .SH 関連項目 \fBmount\fP(2), \fBmount_namespaces\fP(7), \fBpath_resolution\fP(7), \fBmount\fP(8), \fBumount\fP(8) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。