1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (C) 1993 Rickard E. Faith <faith@cs.unc.edu>
4 .\" and Copyright (C) 1994 Andries E. Brouwer <aeb@cwi.nl>
5 .\" and Copyright (C) 2002, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date. The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein. The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
27 .\" Modified 1996-11-04 by Eric S. Raymond <esr@thyrsus.com>
28 .\" Modified 2001-10-13 by Michael Kerrisk <mtk.manpages@gmail.com>
29 .\" Added note on historical behavior of MS_NOSUID
30 .\" Modified 2002-05-16 by Michael Kerrisk <mtk.manpages@gmail.com>
31 .\" Extensive changes and additions
32 .\" Modified 2002-05-27 by aeb
33 .\" Modified 2002-06-11 by Michael Kerrisk <mtk.manpages@gmail.com>
34 .\" Enhanced descriptions of MS_MOVE, MS_BIND, and MS_REMOUNT
35 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
36 .\" 2005-05-18, mtk, Added MNT_EXPIRE, plus a few other tidy-ups.
37 .\" 2008-10-06, mtk: move umount*() material into separate umount.2 page.
38 .\" 2008-10-06, mtk: Add discussion of namespaces.
40 .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
41 .\" all rights reserved.
42 .\" Translated 1997-06-26,SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
43 .\" Updated 2001-05-20, Kentaro Shirakata <argrath@ub32.org>
44 .\" Updated 2001-06-25, Kentaro Shirakata
45 .\" Updated 2001-10-15, Kentaro Shirakata
46 .\" Updated 2002-01-01, Kentaro Shirakata
47 .\" Updated 2002-11-24, Kentaro Shirakata
48 .\" Updated 2003-01-27, Kentaro Shirakata
49 .\" Updated 2005-02-28, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
50 .\" Updated 2005-09-06, Akihiro MOTOKI
51 .\" Updated 2006-07-23, Akihiro MOTOKI, LDP v2.36
52 .\" Updated 2007-01-07, Akihiro MOTOKI, LDP v2.43
53 .\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
54 .\" Updated 2008-08-08, Akihiro MOTOKI, LDP v3.05
55 .\" Updated 2008-11-10, Akihiro MOTOKI, LDP v3.11
56 .\" Updated 2010-04-23, Akihiro MOTOKI, LDP v3.24
58 .\"WORD: lazy umount 遅延アンマウント
59 .\"WORD: Linux-specific Linux 特有
61 .\" motoki 2005-02-28:
62 .\" - subtree をどう訳すか。部分木、部分ツリー、サブツリー。。。何かないか。
64 .TH MOUNT 2 2010-09-10 "Linux" "Linux Programmer's Manual"
66 mount \- ファイルシステムをマウント/アンマウントする
69 .B "#include <sys/mount.h>"
71 .BI "int mount(const char *" source ", const char *" target ,
72 .BI " const char *" filesystemtype ", unsigned long " mountflags ,
73 .BI " const void *" data );
79 で指定されたファイルシステム (デバイス名であることが多いが、
89 Linux 2.4 以降、ひとつのファイルシステムを複数のマウントポイントに
90 結びつけることができ、同じマウントポイントに複数のマウントをスタック
92 .\" Multiple mounts on same mount point: since 2.3.99pre7.
98 で参照できる (例えば "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs",
99 "msdos", "proc", "nfs", "iso9660" 等)。
100 適切なモジュールが読み込まれると、さらに別の値が利用可能になるかもしれない。
104 は、先頭 16 ビットはマジックナンバー 0xC0ED (\fBMS_MGC_VAL\fP) で、
105 残りの 16 ビットがマウントフラグである。
106 マジックナンバーは、カーネルバージョン 2.4 より前では必須であったが、
108 マウントフラグは libc4 と libc5 では \fI<linux/fs.h>\fP 、
109 glibc2 では \fI<sys/mount.h>\fP で定義されており、以下の通りである:
110 .\" FIXME 2.6.15 added flags for "shared subtree" functionality:
111 .\" MS_UNBINDABLE, MS_PRIVATE, MS_SHARED, MS_SLAVE
112 .\" These need to be documented on this page.
114 .\" Documentation/filesystems/sharedsubtree.txt
116 .\" http://lwn.net/Articles/159077/
118 .\" http://myweb.sudhaa.com:2022/~ram/sharedsubtree/paper/sharedsubtree.1.pdf
119 .\" Shared-Subtree Concept, Implementation, and Applications in Linux
120 .\" Al Viro viro@ftp.linux.org.uk
121 .\" Ram Pai linuxram@us.ibm.com
123 .\" http://foss.in/2005/slides/sharedsubtree1.pdf
124 .\" Shared Subtree Concept and Implementation in the Linux Kernel
127 .\" 2.6.25 Added MS_I_VERSION, which needs to be documented.
130 .BR MS_BIND " (Linux 2.4 以降)"
131 .\" 正確には 2.4.0-test9 以降
132 バインドマウントを行う。これはファイルやディレクトリの部分木を
133 ファイルシステム内部の別の場所で見えるようにするものである。
134 バインドマウントを使うと、ファイルシステムをまたいで
145 .\" with the exception of the "hidden" MS_REC mountflags bit
146 (バインドマウントでは、マウントポイントとなるファイルシステムと
148 Linux 2.6.26 以降では、バインドマウントを行う際に
152 .BR MS_DIRSYNC " (Linux 2.5.19 以降)"
153 このファイルシステムへのディレクトリ変更を同期的に行う。
159 このファイルシステムのファイルに対して強制ロックを認める。
162 で述べられている方法でファイル単位で許可をしなければならない)
163 .\" FIXME Say more about MS_MOVE
168 にはすでに存在するマウントポイントを指定し、
172 操作の実行中、部分ツリーがアンマウントされることはない。
173 .IR filesystemtype ", " mountflags ", " data
177 このファイルシステムの (全ての種類の) ファイルのアクセス時刻を更新しない。
180 このファイルシステムのデバイス (スペシャルファイル) へのアクセスを許可しない。
183 このファイルシステムのディレクトリのアクセス時刻を更新しない。
186 で提供される機能のサブセットを提供する。つまり、
193 このファイルシステムにあるプログラムの実行を許可しない。
194 .\" (Possibly useful for a file system that contains non-Linux executables.
195 .\" Often used as a security feature, e.g., to make sure that restricted
196 .\" users cannot execute files uploaded using ftp or so.)
199 このファイルシステムのプログラムを実行するときに、
200 set-user-ID ビットと set-group-ID ビットを無視する。
201 .\" (This is a security feature to prevent users executing set-UID and
202 .\" set-GID programs from removable disk devices.)
205 ファイルシステムを読み込み専用でマウントする。
207 .\" FIXME Document MS_REC, available since 2.4.11.
208 .\" This flag has meaning in conjunction with MS_BIND and
209 .\" also with the shared subtree flags.
211 .BR MS_RELATIME " (Linux 2.6.20 以降)"
212 このファイルシステム上のファイルがアクセスされた際、
213 そのファイルの最終アクセス時刻 (atime) の現在値が
214 最終修正時刻 (mtime) や最終状態変更時刻 (ctime) と
215 等しいか小さい場合にのみ、atime を更新する。
218 のように、最後の内容修正以降にファイルがいつ読み出されたかを知る
222 が指定されていない場合には、このフラグの動作が
224 Linux 2.6.30 より前の動作をさせるためには
227 これに加えて、Linux 2.6.30 以降では、
228 ファイルの最終アクセス時刻が 1 日以上前の場合、
229 ファイルの最終アクセス時刻は常に更新される。
230 .\" Matthew Garrett notes in the patch that added this behavior
231 .\" that this lets utilities such as tmpreaper (which deletes
232 .\" files based on last acces time) work correctly.
240 を、一度アンマウントしてから再マウントするという作業をせずに
261 カーネル 2.4.10 より前では、上記に加えて、
267 .BR MS_SILENT " (Linux 2.6.17 以降)"
273 フラグ (Linux 2.4.12 以降で利用可能) を置き換えるもので、同じ意味を持つ。
275 .BR MS_STRICTATIME " (Linux 2.6.30 以降)"
276 このファイルシステムがアクセスされた際に最終アクセス時刻 (atime)
277 を常に更新する (Linux 2.6.30 より前では、これがデフォルトの動作
283 の両フラグを設定した際の影響を上書きすることができる。
286 ファイルシステムに対して同期的に書き込みを行う。
287 (このファイルシステムの全てのオープンされたファイルに対して、
294 .BR MS_NODEV ", " MS_NOEXEC ", " MS_NOSUID
303 フラグもマウントポイント単位で設定できる。
307 がどのように解釈されるかは、ファイルシステムによって異なる。
308 たいていは、指定されたファイルシステムで利用可能なオプションが
310 各ファイルシステムに対して指定可能なオプションの詳細については
314 成功した場合 0 が返る。失敗した場合 \-1 が返り、
318 以下に示すエラーは、ファイルシステムに依存しないものである。
319 それぞれのファイルシステムタイプには固有のエラーが存在する場合があり、
320 独自の動作をすることもある。詳しくはカーネルのソースを見て欲しい。
323 パスに含まれるディレクトリに検索 (実行) 許可がない
324 .RB ( path_resolution (7)
328 フラグを指定せずに読み込み専用のファイルシステムを
334 オプションでマウントされたファイルシステム上にある。
335 .\" mtk: Probably: write permission is required for MS_BIND, with
336 .\" the error EPERM if not present; CAP_DAC_OVERRIDE is required.
341 または、書き込み用にオープンされたファイルがあり、
342 読み込み専用で再マウントすることができない。
349 が使用中の例としては、あるスレッドの動作ディレクトリ (working
350 directory) であるとか、別のデバイスのマウントポイントであるとか、
351 オープンされたファイルが存在する、などがある。
354 場所を示す引き数のひとつがユーザーのアドレス空間の外を指している。
368 がマウントポイントではないか、\(aq/\(aq なのに、移動
373 パス名の解決中に登場したリンクが多すぎた。
381 .\" motoki: どう訳すのがいいだろうか?
392 がカーネル中で定義 (config) されていない。
395 パス名が空である。もしくは指定されたパスが存在しない。
398 カーネルがファイル名やデータをコピーするための空きページを確保できない。
424 の定義が glibc のヘッダに追加されたのは
425 バージョン 2.12 においてのみである。
426 .\" FIXME: Definitions of the so-far-undocumented MS_UNBINDABLE, MS_PRIVATE,
427 .\" MS_SHARED, and MS_SLAVE were (also) only added to glibc headers in 2.12.
429 この関数は Linux 固有の関数であり、移植を考慮したプログラムでは
435 が \fI<mman.h>\fP に追加されたので
440 Linux 2.4 より前のバージョンでは、
442 オプション付きでマウントされたファイルシステム上の
443 set-UID や set-GID のプログラムを実行しようとすると、
446 Linux 2.4 以降では、このような場合は set-UID ビットや set-GID ビットが
448 .\" この変更は patch-2.4.0-prerelease に含まれている。
450 カーネル 2.4.19 以降の Linux では、プロセス単位のマウント名前空間
451 (mount namespace) が提供されている。マウント名前空間とは、
452 あるプロセスに見えているファイルシステムのマウントの集合である。
453 マウントポイントの名前空間は複数のプロセスで共有することができ、
455 一つのプロセスによる名前空間の変更 (すなわち、マウントやアンマウント) は
456 同じ名前空間を共有する他の全てのプロセスにも見える。
457 (2.4.19 より前の Linux は、一つの名前空間がシステム上の全プロセスで
461 経由で作成された子プロセスは親プロセスのマウント名前空間を共有する。
465 プロセスは自分用 (private) のマウント名前空間を持つことができる。
476 前者の場合、作成されたプロセスの新しい名前空間は
478 を呼び出したプロセスの名前空間の「コピー」で初期化される。
481 を呼び出すと、呼び出し元のプロセスのマウント名前空間が、
482 それまでは他のプロセスと共有していた名前空間の自分用のコピーとなる。
483 これにより、呼び出し元のプロセスがこれ以後に行うマウント/アンマウントは
487 の呼び出し以降に作成した子プロセスには見える)。
488 また、その逆の、他のプロセスが行ったマウント/アンマウントも呼び出し元のプロセスには
493 では、指定された ID を持つプロセスのマウント名前空間における
494 マウントポイントのリストが公開されている。詳細は
499 .BR path_resolution (7),