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"
67 .\"O mount \- mount and unmount file systems
68 mount \- ファイルシステムをマウント/アンマウントする
72 .B "#include <sys/mount.h>"
74 .BI "int mount(const char *" source ", const char *" target ,
75 .BI " const char *" filesystemtype ", unsigned long " mountflags ,
76 .BI " const void *" data );
81 .\"O attaches the file system specified by
83 .\"O (which is often a device name, but can also be a directory name
84 .\"O or a dummy) to the directory specified by
89 で指定されたファイルシステム (デバイス名であることが多いが、
94 .\"O Appropriate privilege (Linux: the
96 .\"O capability) is required to mount file systems.
102 .\"O Since Linux 2.4 a single file system can be visible at
103 .\"O multiple mount points, and multiple mounts can be stacked
104 .\"O on the same mount point.
105 .\"O .\" Multiple mounts on same mount point: since 2.3.99pre7.
106 Linux 2.4 以降、ひとつのファイルシステムを複数のマウントポイントに
107 結びつけることができ、同じマウントポイントに複数のマウントをスタック
109 .\" Multiple mounts on same mount point: since 2.3.99pre7.
112 .\"O .I filesystemtype
113 .\"O argument supported by the kernel are listed in
114 .\"O .I /proc/filesystems
115 .\"O (like "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs",
116 .\"O "msdos", "proc", "nfs", "iso9660" etc.).
117 .\"O Further types may become available when the appropriate modules
123 で参照できる (例えば "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs",
124 "msdos", "proc", "nfs", "iso9660" 等)。
125 適切なモジュールが読み込まれると、さらに別の値が利用可能になるかもしれない。
129 .\"O argument may have the magic number 0xC0ED (\fBMS_MGC_VAL\fP)
130 .\"O in the top 16 bits (this was required in kernel versions prior to 2.4, but
131 .\"O is no longer required and ignored if specified),
132 .\"O and various mount flags (as defined in \fI<linux/fs.h>\fP for libc4 and libc5
133 .\"O and in \fI<sys/mount.h>\fP for glibc2) in the low order 16 bits:
136 は、先頭 16 ビットはマジックナンバー 0xC0ED (\fBMS_MGC_VAL\fP) で、
137 残りの 16 ビットがマウントフラグである。
138 マジックナンバーは、カーネルバージョン 2.4 より前では必須であったが、
140 マウントフラグは libc4 と libc5 では \fI<linux/fs.h>\fP 、
141 glibc2 では \fI<sys/mount.h>\fP で定義されており、以下の通りである:
142 .\" FIXME 2.6.15 added flags for "shared subtree" functionality:
143 .\" MS_UNBINDABLE, MS_PRIVATE, MS_SHARED, MS_SLAVE
144 .\" These need to be documented on this page.
146 .\" Documentation/filesystems/sharedsubtree.txt
148 .\" http://lwn.net/Articles/159077/
150 .\" http://myweb.sudhaa.com:2022/~ram/sharedsubtree/paper/sharedsubtree.1.pdf
151 .\" Shared-Subtree Concept, Implementation, and Applications in Linux
152 .\" Al Viro viro@ftp.linux.org.uk
153 .\" Ram Pai linuxram@us.ibm.com
155 .\" http://foss.in/2005/slides/sharedsubtree1.pdf
156 .\" Shared Subtree Concept and Implementation in the Linux Kernel
159 .\" 2.6.25 Added MS_I_VERSION, which needs to be documented.
162 .\"O .BR MS_BIND " (Linux 2.4 onward)"
163 .BR MS_BIND " (Linux 2.4 以降)"
164 .\"O .\" since 2.4.0-test9
165 .\" 正確には 2.4.0-test9 以降
166 .\"O Perform a bind mount, making a file or a directory subtree visible at
167 .\"O another point within a file system.
168 .\"O Bind mounts may cross file system boundaries and span
172 .\"O .IR filesystemtype
175 .\"O arguments are ignored.
176 .\"O Up until Linux 2.6.26,
178 .\"O was also ignored
179 .\"O .\" with the exception of the "hidden" MS_REC mountflags bit
180 .\"O (the bind mount has the same mount options as
181 .\"O the underlying mount point).
182 バインドマウントを行う。これはファイルやディレクトリの部分木を
183 ファイルシステム内部の別の場所で見えるようにするものである。
184 バインドマウントを使うと、ファイルシステムをまたいで
195 .\" with the exception of the "hidden" MS_REC mountflags bit
196 (バインドマウントでは、マウントポイントとなるファイルシステムと
198 .\"O Since Linux 2.6.26, the
200 .\"O flag is honored when making a bind mount.
201 Linux 2.6.26 以降では、バインドマウントを行う際に
205 .\"O .BR MS_DIRSYNC " (Since Linux 2.5.19)"
206 .BR MS_DIRSYNC " (Linux 2.5.19 以降)"
207 .\"O Make directory changes on this file system synchronous.
208 .\"O (This property can be obtained for individual directories
209 .\"O or subtrees using
210 .\"O .BR chattr (1).)
211 このファイルシステムへのディレクトリ変更を同期的に行う。
217 .\"O Permit mandatory locking on files in this file system.
218 .\"O (Mandatory locking must still be enabled on a per-file basis,
221 .\"O .\" FIXME Say more about MS_MOVE
222 このファイルシステムのファイルに対して強制ロックを認める。
225 で述べられている方法でファイル単位で許可をしなければならない)
226 .\" FIXME Say more about MS_MOVE
231 .\"O specifies an existing mount point and
233 .\"O specifies the new location.
234 .\"O The move is atomic: at no point is the subtree unmounted.
236 .\"O .IR filesystemtype ", " mountflags ", and " data
237 .\"O arguments are ignored.
240 にはすでに存在するマウントポイントを指定し、
244 操作の実行中、部分ツリーがアンマウントされることはない。
245 .IR filesystemtype ", " mountflags ", " data
249 .\"O Do not update access times for (all types of) files on this file system.
250 このファイルシステムの (全ての種類の) ファイルのアクセス時刻を更新しない。
253 .\"O Do not allow access to devices (special files) on this file system.
254 このファイルシステムのデバイス (スペシャルファイル) へのアクセスを許可しない。
257 .\"O Do not update access times for directories on this file system.
258 このファイルシステムのディレクトリのアクセス時刻を更新しない。
259 .\"O This flag provides a subset of the functionality provided by
260 .\"O .BR MS_NOATIME ;
264 .\"O .BR MS_NODIRATIME .
267 で提供される機能のサブセットを提供する。つまり、
274 .\"O Do not allow programs to be executed from this file system.
275 このファイルシステムにあるプログラムの実行を許可しない。
276 .\" (Possibly useful for a file system that contains non-Linux executables.
277 .\" Often used as a security feature, e.g., to make sure that restricted
278 .\" users cannot execute files uploaded using ftp or so.)
281 .\"O Do not honor set-user-ID and set-group-ID bits when executing
282 .\"O programs from this file system.
283 このファイルシステムのプログラムを実行するときに、
284 set-user-ID ビットと set-group-ID ビットを無視する。
285 .\" (This is a security feature to prevent users executing set-UID and
286 .\" set-GID programs from removable disk devices.)
289 .\"O Mount file system read-only.
290 ファイルシステムを読み込み専用でマウントする。
292 .\" FIXME Document MS_REC, available since 2.4.11.
293 .\" This flag has meaning in conjunction with MS_BIND and
294 .\" also with the shared subtree flags.
296 .\"O .BR MS_RELATIME " (Since Linux 2.6.20)"
297 .BR MS_RELATIME " (Linux 2.6.20 以降)"
298 .\"O When a file on this file system is accessed,
299 .\"O only update the file's last access time (atime) if the current value
300 .\"O of atime is less than or equal to the file's last modification time (mtime)
301 .\"O or last status change time (ctime).
302 .\"O This option is useful for programs, such as
304 .\"O that need to know when a file has been read since it was last modified.
305 このファイルシステム上のファイルがアクセスされた際、
306 そのファイルの最終アクセス時刻 (atime) の現在値が
307 最終修正時刻 (mtime) や最終状態変更時刻 (ctime) と
308 等しいか小さい場合にのみ、atime を更新する。
311 のように、最後の内容修正以降にファイルがいつ読み出されたかを知る
313 .\"O Since Linux 2.6.30, the kernel defaults to the behavior provided
314 .\"O by this flag (unless
316 .\"O was specified), and the
317 .\"O .B MS_STRICTATIME
318 .\"O flag is required to obtain traditional semantics.
319 .\"O In addition, since Linux 2.6.30,
320 .\"O the file's last access time is always updated if it
321 .\"O is more than 1 day old.
324 が指定されていない場合には、このフラグの動作が
326 Linux 2.6.30 より前の動作をさせるためには
329 これに加えて、Linux 2.6.30 以降では、
330 ファイルの最終アクセス時刻が 1 日以上前の場合、
331 ファイルの最終アクセス時刻は常に更新される。
332 .\" Matthew Garrett notes in the patch that added this behavior
333 .\" that this lets utilities such as tmpreaper (which deletes
334 .\" files based on last acces time) work correctly.
337 .\"O Remount an existing mount.
338 .\"O This allows you to change the
342 .\"O of an existing mount without having to unmount and remount the file system.
346 .\"O should be the same values specified in the initial
349 .\"O .I filesystemtype
356 を、一度アンマウントしてから再マウントするという作業をせずに
371 .\"O .BR MS_SYNCHRONOUS ,
372 .\"O .BR MS_MANDLOCK ;
373 .\"O before kernel 2.6.16, the following could also be changed:
376 .\"O .BR MS_NODIRATIME ;
377 .\"O and, additionally, before kernel 2.4.10, the following could also be changed:
391 カーネル 2.4.10 より前では、上記に加えて、
397 .\"O .BR MS_SILENT " (since Linux 2.6.17)"
398 .BR MS_SILENT " (Linux 2.6.17 以降)"
399 .\"O Suppress the display of certain
400 .\"O .RI ( printk ())
401 .\"O warning messages in the kernel log.
402 .\"O This flag supersedes the misnamed and obsolete
404 .\"O flag (available since Linux 2.4.12), which has the same meaning.
410 フラグ (Linux 2.4.12 以降で利用可能) を置き換えるもので、同じ意味を持つ。
412 .\"O .BR MS_STRICTATIME " (Since Linux 2.6.30)"
413 .BR MS_STRICTATIME " (Linux 2.6.30 以降)"
414 .\"O Always update the last access time (atime) when files on this
415 .\"O file system are accessed.
416 .\"O (This was the default behavior before Linux 2.6.30.)
417 .\"O Specifying this flag overrides the effect of setting the
422 このファイルシステムがアクセスされた際に最終アクセス時刻 (atime)
423 を常に更新する (Linux 2.6.30 より前では、これがデフォルトの動作
429 の両フラグを設定した際の影響を上書きすることができる。
432 .\"O Make writes on this file system synchronous (as though
437 .\"O was specified for all file opens to this file system).
438 ファイルシステムに対して同期的に書き込みを行う。
439 (このファイルシステムの全てのオープンされたファイルに対して、
445 .\"O From Linux 2.4 onward, the
446 .\"O .BR MS_NODEV ", " MS_NOEXEC ", and " MS_NOSUID
447 .\"O flags are settable on a per-mount-point basis.
448 .\"O From kernel 2.6.16 onward,
451 .\"O .B MS_NODIRATIME
452 .\"O are also settable on a per-mount-point basis.
455 .\"O flag is also settable on a per-mount-point basis.
457 .BR MS_NODEV ", " MS_NOEXEC ", " MS_NOSUID
466 フラグもマウントポイント単位で設定できる。
470 .\"O argument is interpreted by the different file systems.
473 がどのように解釈されるかは、ファイルシステムによって異なる。
474 .\"O Typically it is a string of comma-separated options
475 .\"O understood by this file system.
478 .\"O for details of the options available for each filesystem type.
479 たいていは、指定されたファイルシステムで利用可能なオプションが
481 各ファイルシステムに対して指定可能なオプションの詳細については
484 .\"O .SH "RETURN VALUE"
486 .\"O On success, zero is returned.
487 .\"O On error, \-1 is returned, and
489 .\"O is set appropriately.
490 成功した場合 0 が返る。失敗した場合 \-1 が返り、
495 .\"O The error values given below result from filesystem type independent
497 .\"O Each file-system type may have its own special errors and its
498 .\"O own special behavior.
499 .\"O See the kernel source code for details.
500 以下に示すエラーは、ファイルシステムに依存しないものである。
501 それぞれのファイルシステムタイプには固有のエラーが存在する場合があり、
502 独自の動作をすることもある。詳しくはカーネルのソースを見て欲しい。
505 .\"O A component of a path was not searchable.
507 .\"O .BR path_resolution (7).)
508 .\"O Or, mounting a read-only file system was attempted without giving the
511 .\"O Or, the block device
513 .\"O is located on a file system mounted with the
516 .\"O .\" mtk: Probably: write permission is required for MS_BIND, with
517 .\"O .\" the error EPERM if not present; CAP_DAC_OVERRIDE is required.
518 パスに含まれるディレクトリに検索 (実行) 許可がない
519 .RB ( path_resolution (7)
523 フラグを指定せずに読み込み専用のファイルシステムを
529 オプションでマウントされたファイルシステム上にある。
530 .\" mtk: Probably: write permission is required for MS_BIND, with
531 .\" the error EPERM if not present; CAP_DAC_OVERRIDE is required.
535 .\"O is already mounted.
536 .\"O Or, it cannot be remounted read-only,
537 .\"O because it still holds files open for writing.
538 .\"O Or, it cannot be mounted on
542 .\"O is still busy (it is the working directory of some thread,
543 .\"O the mount point of another device, has open files, etc.).
546 または、書き込み用にオープンされたファイルがあり、
547 読み込み専用で再マウントすることができない。
554 が使用中の例としては、あるスレッドの動作ディレクトリ (working
555 directory) であるとか、別のデバイスのマウントポイントであるとか、
556 オープンされたファイルが存在する、などがある。
559 .\"O One of the pointer arguments points outside the user address space.
560 場所を示す引き数のひとつがユーザーのアドレス空間の外を指している。
564 .\"O had an invalid superblock.
568 .\"O .RB ( MS_REMOUNT )
569 .\"O was attempted, but
571 .\"O was not already mounted on
582 .\"O was attempted, but
584 .\"O was not a mount point, or was \(aq/\(aq.
587 がマウントポイントではないか、\(aq/\(aq なのに、移動
592 .\"O Too many links encountered during pathname resolution.
593 .\"O Or, a move was attempted, while
595 .\"O is a descendant of
597 パス名の解決中に登場したリンクが多すぎた。
605 .\"O (In case no block device is required:)
606 .\"O Table of dummy devices is full.
607 .\" motoki: どう訳すのがいいだろうか?
612 .\"O A pathname was longer than
613 .\"O .BR MAXPATHLEN .
619 .\"O .I filesystemtype
620 .\"O not configured in the kernel.
622 がカーネル中で定義 (config) されていない。
625 .\"O A pathname was empty or had a nonexistent component.
626 パス名が空である。もしくは指定されたパスが存在しない。
629 .\"O The kernel could not allocate a free page to copy filenames or data into.
630 カーネルがファイル名やデータをコピーするための空きページを確保できない。
634 .\"O is not a block device (and a device was required).
643 .\"O is not a directory.
650 .\"O The major number of the block device
652 .\"O is out of range.
658 .\"O The caller does not have the required privileges.
662 .\"O The definitions of
663 .\"O .BR MS_DIRSYNC ,
666 .\"O .BR MS_RELATIME ,
668 .\"O .BR MS_STRICTATIME
669 .\"O were only added to glibc headers in version 2.12.
675 の定義が glibc のヘッダに追加されたのは
676 バージョン 2.12 においてのみである。
677 .\" FIXME: Definitions of the so-far-undocumented MS_UNBINDABLE, MS_PRIVATE,
678 .\" MS_SHARED, and MS_SLAVE were (also) only added to glibc headers in 2.12.
679 .\"O .SH "CONFORMING TO"
681 .\"O This function is Linux-specific and should not be used in
682 .\"O programs intended to be portable.
683 この関数は Linux 固有の関数であり、移植を考慮したプログラムでは
688 .\"O flag was renamed
689 .\"O .B MS_SYNCHRONOUS
691 .\"O when a different
693 .\"O was added to \fI<mman.h>\fP.
698 が \fI<mman.h>\fP に追加されたので
703 .\"O Before Linux 2.4 an attempt to execute a set-UID or set-GID program
704 .\"O on a file system mounted with
708 Linux 2.4 より前のバージョンでは、
710 オプション付きでマウントされたファイルシステム上の
711 set-UID や set-GID のプログラムを実行しようとすると、
714 .\"O Since Linux 2.4 the set-UID and set-GID bits are just silently ignored
716 Linux 2.4 以降では、このような場合は set-UID ビットや set-GID ビットが
718 .\"O .\" The change is in patch-2.4.0-prerelease.
719 .\" この変更は patch-2.4.0-prerelease に含まれている。
720 .\"O .SS Per-process Namespaces
722 .\"O Starting with kernel 2.4.19, Linux provides
723 .\"O per-process mount namespaces.
724 .\"O A mount namespace is the set of file system mounts that
725 .\"O are visible to a process.
726 .\"O Mount-point namespaces can be (and usually are)
727 .\"O shared between multiple processes,
728 .\"O and changes to the namespace (i.e., mounts and unmounts) by one process
729 .\"O are visible to all other processes sharing the same namespace.
730 .\"O (The pre-2.4.19 Linux situation can be considered as one in which
731 .\"O a single namespace was shared by every process on the system.)
732 カーネル 2.4.19 以降の Linux では、プロセス単位のマウント名前空間
733 (mount namespace) が提供されている。マウント名前空間とは、
734 あるプロセスに見えているファイルシステムのマウントの集合である。
735 マウントポイントの名前空間は複数のプロセスで共有することができ、
737 一つのプロセスによる名前空間の変更 (すなわち、マウントやアンマウント) は
738 同じ名前空間を共有する他の全てのプロセスにも見える。
739 (2.4.19 より前の Linux は、一つの名前空間がシステム上の全プロセスで
742 .\"O A child process created by
744 .\"O shares its parent's mount namespace;
745 .\"O the mount namespace is preserved across an
748 経由で作成された子プロセスは親プロセスのマウント名前空間を共有する。
752 .\"O A process can obtain a private mount namespace if:
753 .\"O it was created using the
757 .\"O in which case its new namespace is initialized to be a
759 .\"O of the namespace of the process that called
766 .\"O which causes the caller's mount namespace to obtain a private copy
767 .\"O of the namespace that it was previously sharing with other processes,
768 .\"O so that future mounts and unmounts by the caller are invisible
769 .\"O to other processes (except child processes that the caller
770 .\"O subsequently creates) and vice versa.
771 プロセスは自分用 (private) のマウント名前空間を持つことができる。
782 前者の場合、作成されたプロセスの新しい名前空間は
784 を呼び出したプロセスの名前空間の「コピー」で初期化される。
787 を呼び出すと、呼び出し元のプロセスのマウント名前空間が、
788 それまでは他のプロセスと共有していた名前空間の自分用のコピーとなる。
789 これにより、呼び出し元のプロセスがこれ以後に行うマウント/アンマウントは
793 の呼び出し以降に作成した子プロセスには見える)。
794 また、その逆の、他のプロセスが行ったマウント/アンマウントも呼び出し元のプロセスには
797 .\"O The Linux-specific
798 .\"O .I /proc/PID/mounts
799 .\"O file exposes the list of mount points in the mount
800 .\"O namespace of the process with the specified ID; see
805 では、指定された ID を持つプロセスのマウント名前空間における
806 マウントポイントのリストが公開されている。詳細は
812 .BR path_resolution (7),