fsck from util-linux-ng 2.17.2
fsck from util-linux-ng 2.17.2
FSCK(8) FSCK(8) 名前 fsck - Linux ファイルシステムのチェックと修復を行う 書式 fsck [ -sAVRTNP ] [ -C [ fd ] ] [ -t fstype ] [filesys ... ] [--] [ fs- specific-options ] 説明 fsck は (ひとつまたは複数の) Linux ファイルシステムをチェックし、また指 定 す れ ば 修 復 も 行 う 。 filesys に指定できるのは、デバイス名 (例: /dev/hda1, /dev/sdb2)、ファイルシステムのマウントポイント (例: /, /usr, /home) 、 ext2 ラ ベ ル ま た は UUID 指 定 ( 例: UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd, LABEL=root) であ る 。 通 常 fsck は、物理的に異なるディスク上にある複数のファイルシステムを並列的に チェックし、全ファイルシステムのチェックに要する時間を短縮しようとす る 。 コ マンドラインからファイルシステムがひとつも指定されず、かつ -A オプシ ョンも指定されなかった場合は、 fsck はデフォルトの動作として /etc/fstab に書かれているファイルシステムを逐次的にチェックする。これは -As オプシ ョンを指定した場合の動作と同じである。 fsck の返り値は、以下の状態を表す数の和となる。 0 - エラーなし 1 - ファイルシステムのエラーが修正された 2 - システムをリブートする必要がある 4 - ファイルシステムのエラーが修正されないまま 残っている 8 - 操作エラー 16 - 利用法・文法のエラー 32 - fsck がユーザ要求によってキャンセルされた 128 - 共有ライブラリのエラー 複数のファイルシステムをチェックした場合の返り値は、チェックした各フ ァ イルシステムの返り値に対して、ビットごとの OR をとったものになる。 fsck は、実際には Linux で利用できるさまざまなファイルシステムチェッカ ー (fsck.fstype) への単なるフロントエンドにすぎない。ファイルシステム固 有のチェッカーは、 /sbin, /sbin/fs.d, /sbin/fs, /etc/fs, /etc, 環境変数 PATH 内のディレクトリの順にサーチされる。詳細はファイルシステム固有のチ ェッカーのマニュアルを参照すること。 オプション -s fsck の動作を逐次的にする。複数のファイルシステムをインタラクテ ィブ (対話) モードでチェックする際に有用。 (注意: デフォルトでは e2fsck(8) の動作は対話モードである。 e2fsck(8) を非対話モードで 動作させるには、 -p オプションか -a オプションを使用する。また非 対 話 的にエラーを自動修復させたい場合は -n オプションを利用する 。) -t fslist チェックするファイルシステムのタイプを指定する。 -A オプションが 指定されている場合は、 fslist にマッチするファイルシステムのみを チェックする。 fslist パラメータは、コンマで区切られたファイルシ ステムとオプション指定のリストである。このコンマ区切りのリストに 含まれるファイルシステムのすべてに、否定演算子 ’no’ また は ’!’ を前置することもできる。これにより、 fslist にリストされていない ファイルシステムだけがチェックされる。 fslist のファイルシステム すべてに否定演算子が付けられていない場合は、 fslist にリストされ ているファイルシステムのみがチェックされる。 (訳註: リストの一部 だけに否定演算子を付けることはできない) オプション指定をコンマで区切った形で fslist に含めても良い。これ らは opts=fs-option という書式でなければならない。オプション指定 が存在すると、 /etc/fstab のマウントオプションのフィールドに fs- option があるファイルシステムのみがチェックされる。オプション 指 定の前に否定演算子がある場合は、 /etc/fstab のマウントオプション のフィールドに fs-option がないファイルシステムのみがチェック さ れる。 例 えば、 opts=ro を fslist に指定すると、 /etc/fstab にリストさ れているファイルシステムのうち、 ro オプションを持つものだけがチ ェックされる。 fsck プログラムへの非公式なユーザインターフェース変更に依存した ブートスクリプトを使っている Mandrake ディストリビューションとの 互換性のため、 fslist にファイルシステムタイプ loop があった場合 、 -t オプションの引き数として opts=loop が指定されていると仮 定 する。 通 常ファイルシステムのタイプは、 filesys を /etc/fstab ファイル から検索して見つかったエントリから取得する。ファイルシステムのタ イ プが取得できず、かつ 1 つのファイルシステムだけが -t オプショ ンの引き数になっている場合、 fsck はそれを利用する。指定してある ファイルシステムタイプを利用できない場合は、デフォルトのファイル システムタイプ (現時点では ext2) を利用する。 -A /etc/fstab に列記されているファイルシステムをすべてチェックす る 。 このオプションを用いれば、複数のファイルシステムに対して fsck をひとつひとつ単独で実行しなくてもよいため、システムの初期設定フ ァイルである /etc/rc 中でよく利用される。 -P オプション (後述) が指定されていなければ、ルートファイルシス テムが最初にチェックされる。その後、 /etc/fstab ファイルの 第 6 フ ィールドである fs_passno の順序にしたがって他のファイルシステ ムがチェックされる。 fs_passno の値が 0 であるファイルシステムは 、スキップされて一切チェックされない。 fs_passno の値が 0 より大 きいファイルシステムは、小さい fs_passno 値を持ったものを優先 し 、順番にチェックされる。同じ番号が指定されているファイルシステム が複数ある場合には、 fsck はそれらを並列してチェックしようとする 。しかし同じ物理ディスクにあるファイルシステムの同時チェックは避 ける。 したがって、 /etc/fstab に対する最も普通の設定は、ルートファイル シ ス テムの fs_passno を 1 とし、他のすべてのファイルシステムの fs_passno を 2 とするものである。こうすると fsck は、(効果が期待 できる場合には) 自動的にファイルシステムチェッカーを同時に並列し て動作させる。何らかの理由で複数ファイルシステムの並列チェックを したくない場合には、システム管理者はこの設定をしてはいけない。た とえばマシンのメモリが少なく、余分なページングが問題になる場合な どがこれにあたる。 -C [ fd ] 作業完了分・残り分の棒グラフをサポートしているファイルシステムチ ェッカー (現在 ext2 と ext3 用のものだけ) に、表示を行わせ る 。 fsck は一度にひとつのチェッカーだけが表示を行うように、複数のチ ェッカーを管理する。 GUI フロントエンドにはファイルディスクリ プ タ fd を指定することができる。この場合、棒グラフの情報はファイル ディスクリプタに送られる。 -N 実際には実行せず、何が行われるかだけを表示する。 -P -A オプションが指定されている場合、ルートファイルシステムを他 の ファイルシステムと並列にチェックする。ルートファイルシステムが壊 れている場合には e2fsck(8) 自体が壊れている可能性もあるため、 こ のオプションを用いるのは安全性を損なうことになる。このオプション は、ルートファイルシステムを小さくコンパクトなパーティションに切 りなおしたくないシステム管理者向けのオプションである (ルートファ イルシステムを小さくコンパクトにまとめるのが正しい解なのだが)。 -R -A オプションを用いて全てのファイルシステムをチェックする際に 、 ルートファイルシステムをチェックしないようにする (ルートファイル システムがすでに read/write でマウントされている場合)。 -T 起動時にタイトルを表示しない。 -V fsck から起動されるシステム固有のコマンドを含め、詳細な表示を す る。 fs-specific-options fsck が理解しないオプションは、ファイルシステム固有のチェッカー に渡される。これらのオプションは引き数をとってはならない。なぜな ら、どのオプションが引き数をとるか (とらないか) を fsck が正しく 判断できる方法がないためである。 -- 以降に指定したオプションと引き数は、ファイルシステム固有の オ プションとしてファイルシステム固有のチェッカーに渡される。 fsck は任意の複雑なオプションをファイルシステム固有のチェッカー に渡すようには設計されていない点に注意すること。複雑なことをやろ うとするときは、ファイルシステム固有のチェッカーを直接実行してほ しい。非常に複雑なオプションと引き数を fsck に渡した場合に、期待 し た 動作をしなかったとしても、バグとして報告するには及ばない。 fsck にやらせるべきではないことを、あなたがやったのだから。 ファイルシステム固有の fsck のオプションは、標準化されていない。確か で ない場合は、ファイルシステム固有のチェッカーの man ページを調べること。 保証されたものではないが、以下のオプションはほとんどのファイルシステ ム チェッカーでサポートされている。 -a 質問なしで自動的にファイルシステムを修復する (このオプションの使 用には注意を要する)。ほとんどのファイルシステムチェッカー は -a オ プションに対応しているが、 e2fsck(8) においては -a オプション は過去互換性のために準備されているだけである。したがって e2fsck で は、このオプションは (安全に利用できる) -p オプションにマップ され、いくつかのフィルシステムチェッカーがサポートしている -a に はマップされない。 -n ファイルシステム固有のチェッカーの中には、 -n オプションが指定さ れると、問題点を修復するのではなく、その問題点を単に標準出力に書 き出すものもある。しかし全てのファイルシステム固有のチェッカーが 、このような動作をするわけではない。特に fsck.reiserfs(8) は、こ の オ プ シ ョ ン が 指 定 さ れ て も破損箇所を報告しない。また fsck.minix(8) は、 -n オプションを全くサポートしていない。 -r 対話的にファイルシステムを修復する (確認を求める)。注意: fsck が 並列に動作している場合にこのオプションを利用するのはあまり賢いと はいえない。 e2fsck においては並列動作がデフォルトであり、このオ プションは過去互換性のためにのみ準備されている。 -y ファイルシステム固有のチェッカーの中には、 -y オプションが指定さ れると、検出されたファイルシステムの破損箇所を常に自動的に修復し ようとするものもある。エキスパートは、より上手に fsck を手動で実 行させることができる場合もある。全てのファイルシステム固有のチェ ッカーが、このオプションを実装しているわけではない点に注意するこ と。この man ページを書いている時点では、特に fsck.minix(8) と fsck.cramfs(8) は -y オプションをサポートしていない。 著者 Theodore Ts’o (tytso@mit.edu) ファイル /etc/fstab 環境変数 fsck プログラムの振舞いは、以下の環境変数による影響を受ける。 FSCK_FORCE_ALL_PARALLEL この環境変数が設定されていると、 fsck は指定されたファイルシステ ムすべてを、それらのファイルシステムが同じデバイス上にあるように 見えるかどうかを問わず、並列にチェックしようとする。 (これは IBM や EMC などの会社から販売されているような、 RAID システムやハ イ エンドのストレージシステムで有用である。) FSCK_MAX_INST この環境変数は、同時に動作するファイルシステムチェッカーの最大数 を制限する。この指定を行えば、多数のディスクを備えたシステムにお いて fsck がたくさんのファイルシステムチェッカーを同時に起動し、 システムで利用できる CPU やメモリなどの資源に過度の負荷を与え て し まうことを避けることができる。この値を 0 にすると、spawn する プロセス数の制限がなくなる。現在はこれがデフォルトだが、 fsck の 将 来の版では、OS からアカウンティングデータを取得することにより 、同時に行うファイルシステムチェックの数を自動的に決めるようにな るかもしれない。 PATH PATH 環境変数はファイルシステムチェッカーを探索する際に用いられ る。まず最初に、一連のシステムディレクトリが検索される。これらは /sbin, /sbin/fs.d, /sbin/fs, /etc/fs, /etc である。これに続いて PATH 環境変数に指定されたディレクトリ群が検索される。 FSTAB_FILE この環境変数を用いると、システム管理者は /etc/fstab ファイルの標 準的な置場所を変更できる。これは fsck のテストを行う開発者にとっ ても便利である。 関連項目 fstab(5), mkfs(8), fsck.ext2(8) または fsck.ext3(8) また は e2fsck(8), cramfsck(8), fsck.minix(8), fsck.msdos(8), fsck.jfs(8), fsck.nfs(8), fsck.vfat(8), fsck.xfs(8), fsck.xiafs(8), reiserfsck(8). E2fsprogs version 1.39 May 2006 FSCK(8)
FSCK(8) MAINTENANCE COMMANDS FSCK(8) NAME fsck - check and repair a Linux file system SYNOPSIS fsck [-sAVRTMNP] [-C [fd]] [-t fstype] [filesys...] [--] [fs-specific- options] DESCRIPTION fsck is used to check and optionally repair one or more Linux file sys- tems. filesys can be a device name (e.g. /dev/hdc1, /dev/sdb2), a mount point (e.g. /, /usr, /home), or an ext2 label or UUID specifier (e.g. UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Nor- mally, the fsck program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of the filesystems. If no filesystems are specified on the command line, and the -A option is not specified, fsck will default to checking filesystems in /etc/fstab serially. This is equivalent to the -As options. The exit code returned by fsck is the sum of the following conditions: 0 - No errors 1 - File system errors corrected 2 - System should be rebooted 4 - File system errors left uncorrected 8 - Operational error 16 - Usage or syntax error 32 - Fsck canceled by user request 128 - Shared library error The exit code returned when multiple file systems are checked is the bit-wise OR of the exit codes for each file system that is checked. In actuality, fsck is simply a front-end for the various file system checkers (fsck.fstype) available under Linux. The file system-specific checker is searched for in /sbin first, then in /etc/fs and /etc, and finally in the directories listed in the PATH environment variable. Please see the file system-specific checker manual pages for further details. OPTIONS -s Serialize fsck operations. This is a good idea if you are checking multiple filesystems and the checkers are in an inter- active mode. (Note: e2fsck(8) runs in an interactive mode by default. To make e2fsck(8) run in a non-interactive mode, you must either specify the -p or -a option, if you wish for errors to be corrected automatically, or the -n option if you do not.) -t fslist Specifies the type(s) of file system to be checked. When the -A flag is specified, only filesystems that match fslist are checked. The fslist parameter is a comma-separated list of filesystems and options specifiers. All of the filesystems in this comma-separated list may be prefixed by a negation operator ’no’ or ’!’, which requests that only those filesystems not listed in fslist will be checked. If all of the filesystems in fslist are not prefixed by a negation operator, then only those filesystems listed in fslist will be checked. Options specifiers may be included in the comma-separated fslist. They must have the format opts=fs-option. If an options specifier is present, then only filesystems which con- tain fs-option in their mount options field of /etc/fstab will be checked. If the options specifier is prefixed by a negation operator, then only those filesystems that do not have fs-option in their mount options field of /etc/fstab will be checked. For example, if opts=ro appears in fslist, then only filesystems listed in /etc/fstab with the ro option will be checked. For compatibility with Mandrake distributions whose boot scripts depend upon an unauthorized UI change to the fsck program, if a filesystem type of loop is found in fslist, it is treated as if opts=loop were specified as an argument to the -t option. Normally, the filesystem type is deduced by searching for filesys in the /etc/fstab file and using the corresponding entry. If the type can not be deduced, and there is only a sin- gle filesystem given as an argument to the -t option, fsck will use the specified filesystem type. If this type is not avail- able, then the default file system type (currently ext2) is used. -A Walk through the /etc/fstab file and try to check all file sys- tems in one run. This option is typically used from the /etc/rc system initialization file, instead of multiple commands for checking a single file system. The root filesystem will be checked first unless the -P option is specified (see below). After that, filesystems will be checked in the order specified by the fs_passno (the sixth) field in the /etc/fstab file. Filesystems with a fs_passno value of 0 are skipped and are not checked at all. Filesystems with a fs_passno value of greater than zero will be checked in order, with filesystems with the lowest fs_passno number being checked first. If there are multiple filesystems with the same pass number, fsck will attempt to check them in parallel, although it will avoid running multiple filesystem checks on the same physical disk. fsck does not check stacked devices (RAIDs, dm-crypt, ...) in parallel with any other device. See below for FSCK_FORCE_ALL_PARALLEL setting. The /sys filesystem is used to detemine dependencies between devices. Hence, a very common configuration in /etc/fstab files is to set the root filesystem to have a fs_passno value of 1 and to set all other filesystems to have a fs_passno value of 2. This will allow fsck to automatically run filesystem checkers in parallel if it is advantageous to do so. System administrators might choose not to use this configuration if they need to avoid mul- tiple filesystem checks running in parallel for some reason --- for example, if the machine in question is short on memory so that excessive paging is a concern. fsck normally does not check whether the device actually exists before calling a file system specific checker. Therefore non- existing devices may cause the system to enter file system repair mode during boot if the filesystem specific checker returns a fatal error. The /etc/fstab mount option nofail may be used to have fsck skip non-existing devices. fsck also skips non-existing devices that have the special file system type auto -C [ fd ] Display completion/progress bars for those filesystem checkers (currently only for ext2 and ext3) which support them. Fsck will manage the filesystem checkers so that only one of them will display a progress bar at a time. GUI front-ends may spec- ify a file descriptor fd, in which case the progress bar information will be sent to that file descriptor. -M Do not check mounted filesystems and return an exit code of 0 for mounted filesystems. -N Don’t execute, just show what would be done. -P When the -A flag is set, check the root filesystem in parallel with the other filesystems. This is not the safest thing in the world to do, since if the root filesystem is in doubt things like the e2fsck(8) executable might be corrupted! This option is mainly provided for those sysadmins who don’t want to repar- tition the root filesystem to be small and compact (which is really the right solution). -R When checking all file systems with the -A flag, skip the root file system (in case it’s already mounted read-write). -T Don’t show the title on startup. -V Produce verbose output, including all file system-specific com- mands that are executed. fs-specific-options Options which are not understood by fsck are passed to the filesystem-specific checker. These arguments must not take arguments, as there is no way for fsck to be able to properly guess which arguments take options and which don’t. Options and arguments which follow the -- are treated as file system-specific options to be passed to the file system-specific checker. Please note that fsck is not designed to pass arbitrarily com- plicated options to filesystem-specific checkers. If you’re doing something complicated, please just execute the filesystem- specific checker directly. If you pass fsck some horribly com- plicated option and arguments, and it doesn’t do what you expect, don’t bother reporting it as a bug. You’re almost cer- tainly doing something that you shouldn’t be doing with fsck. Options to different filesystem-specific fsck’s are not standardized. If in doubt, please consult the man pages of the filesystem-specific checker. Although not guaranteed, the following options are supported by most file system checkers: -a Automatically repair the file system without any questions (use this option with caution). Note that e2fsck(8) supports -a for backwards compatibility only. This option is mapped to e2fsck’s -p option which is safe to use, unlike the -a option that some file system checkers support. -n For some filesystem-specific checkers, the -n option will cause the fs-specific fsck to avoid attempting to repair any problems, but simply report such problems to stdout. This is however not true for all filesystem-specific checkers. In particular, fsck.reiserfs(8) will not report any corruption if given this option. fsck.minix(8) does not support the -n option at all. -r Interactively repair the filesystem (ask for confirmations). Note: It is generally a bad idea to use this option if multiple fsck’s are being run in parallel. Also note that this is e2fsck’s default behavior; it supports this option for backwards compatibility reasons only. -y For some filesystem-specific checkers, the -y option will cause the fs-specific fsck to always attempt to fix any detected filesystem corruption automatically. Sometimes an expert may be able to do better driving the fsck manually. Note that not all filesystem-specific checkers implement this option. In particu- lar fsck.minix(8) and fsck.cramfs(8) does not support the -y option as of this writing. AUTHOR Theodore Ts’o (tytso@mit.edu) AVAILABILITY The blkid command is part of the util-linux-ng package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. FILES /etc/fstab. ENVIRONMENT VARIABLES The fsck program’s behavior is affected by the following environment variables: FSCK_FORCE_ALL_PARALLEL If this environment variable is set, fsck will attempt to run all of the specified filesystems in parallel, regardless of whether the filesystems appear to be on the same device. (This is useful for RAID systems or high-end storage systems such as those sold by companies such as IBM or EMC.) Note that the fs_passno value is still used. FSCK_MAX_INST This environment variable will limit the maximum number of file system checkers that can be running at one time. This allows configurations which have a large number of disks to avoid fsck starting too many file system checkers at once, which might overload CPU and memory resources available on the system. If this value is zero, then an unlimited number of processes can be spawned. This is currently the default, but future versions of fsck may attempt to automatically determine how many file system checks can be run based on gathering accounting data from the operating system. PATH The PATH environment variable is used to find file system check- ers. A set of system directories are searched first: /sbin, /sbin/fs.d, /sbin/fs, /etc/fs, and /etc. Then the set of direc- tories found in the PATH environment are searched. FSTAB_FILE This environment variable allows the system administrator to override the standard location of the /etc/fstab file. It is also useful for developers who are testing fsck. SEE ALSO fstab(5), mkfs(8), fsck.ext2(8) or fsck.ext3(8) or e2fsck(8), cramf- sck(8), fsck.minix(8), fsck.msdos(8), fsck.jfs(8), fsck.nfs(8), fsck.vfat(8), fsck.xfs(8), fsck.xiafs(8), reiserfsck(8). Linux February 2009 FSCK(8)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa