[JF-gofer:10016] [Release] linux3.4.1 nilfs2.txt

Seiji Kaneko skaneko @ a2.mbn.or.jp
2012年 10月 2日 (火) 07:45:03 JST


かねこです。題記をリリースします。
---------- >8 ---------- >8
TITL: nilfs2
CONT: nilfs2 ファイルシステムの解説
NAME: filesystems/nilfs2
JDAT: 2012/09/05
BVER: 3.4.1
AUTH: unknown
TRNS: Seiji Kaneko < skaneko at a2 dot mbn dot or dot jp >
---------- >8 ---------- >8
=========================================================
これは、
Linux-3.4.1/Documentation/filesystems/nilfs2.txt の和訳です。
翻訳団体: JF プロジェクト < http://linuxjf.sourceforge.jp/ >
更新日 : 2012/09/05
翻訳者 : Seiji Kaneko < skaneko at a2 dot mbn dot or dot jp >
=========================================================
NILFS2
------

#NILFS2 is a log-structured file system (LFS) supporting continuous
#snapshotting.  In addition to versioning capability of the entire file
#system, users can even restore files mistakenly overwritten or
#destroyed just a few seconds ago.  Since NILFS2 can keep consistency
#like conventional LFS, it achieves quick recovery after system
#crashes.
NILFS2 は連続スナップショットをサポートするログ構造ファイルシステ
ム (LFS) です。ファイルシステム全体に対するバージョン機能に加え、ユ
ーザが数秒前に誤って上書きや破壊したファイルの回復を行うことすら可
能です。NILFS2 は従来の LFS のように一貫性を保つ機能を持っています
から、システムクラッシュ後の素早い回復も実現しています。

#NILFS2 creates a number of checkpoints every few seconds or per
#synchronous write basis (unless there is no change).  Users can select
#significant versions among continuously created checkpoints, and can
#change them into snapshots which will be preserved until they are
#changed back to checkpoints.
NILFS2 は数秒毎に、あるいは同期書き込みを基に (変更がない場合を除
いて) 多数のチェックポイントを作成しています。ユーザは継続的に作ら
れたチェックポイントから必要とするバージョンを選択し、そのバージョ
ンをスナップショットに変換できます。スナップショットはチェックポイ
ントに戻されるまで保持されます。

#There is no limit on the number of snapshots until the volume gets
#full.  Each snapshot is mountable as a read-only file system
#concurrently with its writable mount, and this feature is convenient
#for online backup.
ボリュームが一杯にならない限り、スナップショット数の制限はありま
せん。各スナップショットはリードオンリーのファイルシステムとして、
書き込み可能なマウントと同時にマウント可能であり、これはオンライ
ンバックアップに有用な機能です。

#The userland tools are included in nilfs-utils package, which is
#available from the following download page.  At least "mkfs.nilfs2",
#"mount.nilfs2", "umount.nilfs2", and "nilfs_cleanerd" (so called
#cleaner or garbage collector) are required.  Details on the tools are
#described in the man pages included in the package.
以下のダウンロードページで提供されている nilfs-utils パッケージに
ユーザランドツールが収録されています。少なくとも、"mkfs.nilfs2"、
"mount.nilfs2"、"umount.nilfs2" と "nilfs_cleanerd" (いわばクリー
ナ兼ガベージコレクタ) が必要です。これらのツールの詳細は、パッケ
ージに同梱されている man ページに記載があります。

#Project web page:    http://www.nilfs.org/en/
#Download page:       http://www.nilfs.org/en/download.html
#Git tree web page:   http://www.nilfs.org/git/
#List info            http://vger.kernel.org/vger-lists.html#linux-nilfs
プロジェクトウェブページ: http://www.nilfs.org/en/
ダウンロードページ:       http://www.nilfs.org/en/download.html
Git ツリーウェブページ:   http://www.nilfs.org/git/
メーリングリスト          http://vger.kernel.org/vger-lists.html#linux-nilfs

#Caveats
#=======
断り書き
=======

#Features which NILFS2 does not support yet:
NILFS2 がまだサポートしていない機能は以下のとおりです。

#	- atime
#	- extended attributes
#	- POSIX ACLs
#	- quotas
#	- fsck
#	- defragmentation
	- atime
	- 拡張アトリビュート
	- POSIX ACL
	- クオータ
	- fsck
	- デフラグ

#Mount options
#=============
マウントオプション
=================

#NILFS2 supports the following mount options:
#(*) == default
NILFS2 は以下のマウントオプションをサポートしています。
(*) は 標準値

#barrier(*)		This enables/disables the use of write barriers.  This
#nobarrier		requires an IO stack which can support barriers, and
#			if nilfs gets an error on a barrier write, it will
#			disable again with a warning.
#errors=continue		Keep going on a filesystem error.
#errors=remount-ro(*)	Remount the filesystem read-only on an error.
#errors=panic		Panic and halt the machine if an error occurs.
#cp=n			Specify the checkpoint-number of the snapshot to be
#			mounted.  Checkpoints and snapshots are listed by lscp
#			user command.  Only the checkpoints marked as snapshot
#			are mountable with this option.  Snapshot is read-only,
#			so a read-only mount option must be specified together.
#order=relaxed(*)	Apply relaxed order semantics that allows modified data
#			blocks to be written to disk without making a
#			checkpoint if no metadata update is going.  This mode
#			is equivalent to the ordered data mode of the ext3
#			filesystem except for the updates on data blocks still
#			conserve atomicity.  This will improve synchronous
#			write performance for overwriting.
#order=strict		Apply strict in-order semantics that preserves sequence
#			of all file operations including overwriting of data
#			blocks.  That means, it is guaranteed that no
#			overtaking of events occurs in the recovered file
#			system after a crash.
#norecovery		Disable recovery of the filesystem on mount.
#			This disables every write access on the device for
#			read-only mounts or snapshots.  This option will fail
#			for r/w mounts on an unclean volume.
barrier(*)		書き込みバリアを有効化/無効化する。この機能には
nobarrier		書き込みバリアをサポートした I/O スタックが必要で、
			バリア付き書き込みで nilfs がエラー報告を受けた場合
			は警告メッセージを出して書きこみバリアが無効化され
			る。
errors=continue		ファイルシステムエラー時に処理を続行する。
errors=remount-ro(*)	エラー時にファイルシステムをリードオンリーで再
			マウントする。
errors=panic		エラー時にパニックとし、マシン動作を停止する。
cp=n			マウント対象とするスナップショットのチェックポイ
			ント番号を指定する。チェックポイントとスナップシ
			ョットは lscp コマンドで一覧可能である。スナップシ
			ョットとしてマークしたチェックポイントのみがこの
			オプションでマウント可能である。スナップショットは
			読み出しのみのため、読み出しのみのマウントオプ
			ション指定を合わせて指示する必要がある。
order=relaxed(*)	メタデータ変更を伴わない場合、変更されたデータブ
			ロックをチェックポイントを作成することなしにディ
			スクに書き込む緩和された順序制御手順を採用する。
			このモードはデータブロックの更新のアトミック処理性
			が維持されている点を除いては ext3 ファイルシステムの
			ordered モードに相当する。このモードにより、上
			書き時の同期書き込み性能が向上する。
order=strict		データブロックへの上書きを含む全てのファイル操作
			の順序制御を、順序どおりに厳密に行う順序制御手順
			を採用する。これにより、クラッシュ後の回復された
			ファイルシステムでイベントの追い抜きが発生してい
			ないことが保証される。
norecovery		マウント時のファイルシステムのリカバリを無効化する。
			このオプションは、読み出し専用のマウントおよびスナ
			ップショットでの、すべてのデバイスの書き込みを抑止する。
			このオプションをクリーンでない読み書き可能なマウン
			トに対して指定した場合、失敗する。
#discard			This enables/disables the use of discard/TRIM commands.
#nodiscard(*)		The discard/TRIM commands are sent to the underlying
#			block device when blocks are freed.  This is useful
#			for SSD devices and sparse/thinly-provisioned LUNs.
discard			discard/TRIM コマンドの利用を有効化/無効化する。
nodiscard(*)		discard/TRIM コマンドは、ブロックの開放時、下位ブロ
			ックに対して発行される。これは SSD やスパースファイ
			ル/シンプロビジョニングを用いている LUN で有益なオ
			プションである。

#NILFS2 usage
#============
NILFS2 の利用法
==============

#To use nilfs2 as a local file system, simply:
ローカルファイルシステムとして nilfs2 を用いるには、単に以下のようにして
ください。

# mkfs -t nilfs2 /dev/block_device
# mount -t nilfs2 /dev/block_device /dir

#This will also invoke the cleaner through the mount helper program
#(mount.nilfs2).
この処理では同時にマウントヘルパープログラム (mount.nilfs2) によりクリー
ナが起動されます。

#Checkpoints and snapshots are managed by the following commands.
#Their manpages are included in the nilfs-utils package above.
チェックポイントとスナップショットは以下のコマンドで管理します。これらの
コマンドの man ページは上記の nilfs-utils に収録されています。

#  lscp     list checkpoints or snapshots.
#  mkcp     make a checkpoint or a snapshot.
#  chcp     change an existing checkpoint to a snapshot or vice versa.
#  rmcp     invalidate specified checkpoint(s).
  lscp     チェックポイントとスナップショットを列挙する。
  mkcp     チェックポイントやスナップショットを作成する
  chcp     既存のチェックポイントをスナップショットに変換する。またはそ
  	   の逆操作。
  rmcp     指定されたチェックポイントを無効化する。

#To mount a snapshot,
スナップショットをマウントするには以下のようにします。

# mount -t nilfs2 -r -o cp=<cno> /dev/block_device /snap_dir

#where <cno> is the checkpoint number of the snapshot.
ここで、<cno> はスナップショットのチェックポイント番号です。

#To unmount the NILFS2 mount point or snapshot, simply:
NILFS2 マウントポイントまたはスナップショットをアンマウントするには、単
に以下のようにしてください。

# umount /dir

#Then, the cleaner daemon is automatically shut down by the umount
#helper program (umount.nilfs2).
その後、umount ヘルパープログラム (umount.nilfs2) によりクリーナデーモ
ンが自動的にシャットダウンされます。

#Disk format
#===========
ディスクフォーマット
===================

#A nilfs2 volume is equally divided into a number of segments except
#for the super block (SB) and segment #0.  A segment is the container
#of logs.  Each log is composed of summary information blocks, payload
#blocks, and an optional super root block (SR):
nilfs2 ボリュームはスーパーブロック (SB) とセグメント #0、それ以外は同
一サイズの複数セグメントに分割されています。セグメントはログのコンテナ
です。各ログはサマリ情報ブロックと、ペイロードブロック、オプションのス
ーパールートブロック (SR) から構成されています。

#   ______________________________________________________
#  | |SB| | Segment | Segment | Segment | ... | Segment | |
#  |_|__|_|____0____|____1____|____2____|_____|____N____|_|
#  0 +1K +4K       +8M       +16M      +24M  +(8MB x N)
#       .             .            (Typical offsets for 4KB-block)
#    .                  .
#  .______________________.
#  | log | log |... | log |
#  |__1__|__2__|____|__m__|
#        .       .
#      .               .
#    .                       .
#  .______________________________.
#  | Summary | Payload blocks  |SR|
#  |_blocks__|_________________|__|
   ___________________________________________________________
  | |SB| |セグメント|セグメント|セグメント| ... |セグメント| |
  |_|__|_|____0_____|____1__+__|____2_____|_____|____N__+__|_|
  0 +1K +4K        +8M       +16M      +24M   +(8MB x N)
       .             .            (4KB-ブロックの場合の通常のオフセット)
    .                  .
  ._______________________
  | ログ| ログ|... | ログ|
  |__1__|__2__|____|__m__|
        .       .
      .               .
    .                       .
  .________________________________.
  |サマリ情報| ペイロード      |SR|
  |_ブロック_|__ブロック_______|__|

#The payload blocks are organized per file, and each file consists of
#data blocks and B-tree node blocks:
ペイロードブロックは各ファイルに対応して構成されており、各ファイルはデ
ータブロックと B-ツリーノードブロックで構成されています。

#    |<---       File-A        --->|<---       File-B        --->|
#   _______________________________________________________________
#    | Data blocks | B-tree blocks | Data blocks | B-tree blocks | ...
#   _|_____________|_______________|_____________|_______________|_
   |<---       ファイル-A       --->|<---     ファイル-B       --->|
   _________________________________________________________________
   | データ        | B-tree         | データ       | B-tree        | ...
   |__ブロック_____|___ブロック_____|__ブロック ___|___ブロック____|_


#Since only the modified blocks are written in the log, it may have
#files without data blocks or B-tree node blocks.
変更されたブロックのみがログに書かれるため、データブロックや B-ツリー
ノードブロックを持たないファイルが存在するかもしれません。

#The organization of the blocks is recorded in the summary information
#blocks, which contains a header structure (nilfs_segment_summary), per
#file structures (nilfs_finfo), and per block structures (nilfs_binfo):
ブロックの構成は、サマリ情報ブロックに書き込まれます。この構成には、ヘ
ッダ構造 (nilfs_segment_summary)、ファイル毎の構造 (nilfs_finfo) とブロ
ック毎の構造 (nilfs_binfo) が含まれます。

#  _________________________________________________________________________
# | Summary | finfo | binfo | ... | binfo | finfo | binfo | ... | binfo |...
# |_blocks__|___A___|_(A,1)_|_____|(A,Na)_|___B___|_(B,1)_|_____|(B,Nb)_|___
  _________________________________________________________________________
 |サマリ情報 | finfo | binfo | ... | binfo | finfo | binfo | ... | binfo |...
 |_ブロック__|___A___|_(A,1)_|_____|(A,Na)_|___B___|_(B,1)_|_____|(B,Nb)_|___


#The logs include regular files, directory files, symbolic link files
#and several meta data files.  The mata data files are the files used
#to maintain file system meta data.  The current version of NILFS2 uses
#the following meta data files:
ログには一般ファイル、ディレクトリファイル、シンボリックリンクファイル
と幾種かのメタデータファイルが含まれます。メタデータファイルはファイル
システムメタデータを維持管理するためのファイルです。現在の版の NILFS2
では以下のメタデータファイルを使っています。

# 1) Inode file (ifile)             -- Stores on-disk inodes
# 2) Checkpoint file (cpfile)       -- Stores checkpoints
# 3) Segment usage file (sufile)    -- Stores allocation state of segments
# 4) Data address translation file  -- Maps virtual block numbers to usual
#    (DAT)                             block numbers.  This file serves to
#                                      make on-disk blocks relocatable.
 1) Inode ファイル (ifile)          -- オンディスク inode を格納します
 2) Checkpoint ファイル (cpfile)    -- チェックポイントを格納します
 3) Segment usage ファイル (sufile) -- セグメントの割り当て状況を格納
 					します
 4) データアドレス変換ファイル      -- 仮想ブロック番号と通常のブロッ
 	  (DAT)			       ク番号をマップします。このファ
	   				イルはディスク上のブロックを再
					配置可能にします。

#The following figure shows a typical organization of the logs:
以下の図は、ログの典型的な構成を示します。

#  _________________________________________________________________________
# | Summary | regular file | file  | ... | ifile | cpfile | sufile | DAT |SR|
# |_blocks__|_or_directory_|_______|_____|_______|________|________|_____|__|
  _____________________________________________________________________________________
 |サマリ情報| 通常ファイルまたは | ファイル  | ... | ifile | cpfile | sufile | DAT |SR|
 |_ブロック_|_ディレクトリ_______|___________|_____|_______|________|________|_____|__|

#To stride over segment boundaries, this sequence of files may be split
#into multiple logs.  The sequence of logs that should be treated as
#logically one log, is delimited with flags marked in the segment
#summary.  The recovery code of nilfs2 looks this boundary information
#to ensure atomicity of updates.
セグメント境界をまたぐために、このファイルのシーケンスは複数のログに分
割可能です。一連のログは論理的には一つのログとして扱われ、セグメ
ントサマリ内でマークされたフラグで分割されます。nilfs2 のリカバリコード
はこの境界情報を見て更新のアトミック性を保証します。

#The super root block is inserted for every checkpoints.  It includes
#three special inodes, inodes for the DAT, cpfile, and sufile.  Inodes
#of regular files, directories, symlinks and other special files, are
#included in the ifile.  The inode of ifile itself is included in the
#corresponding checkpoint entry in the cpfile.  Thus, the hierarchy
#among NILFS2 files can be depicted as follows:
スーパールートブロックはチェックポイント毎に挿入されます。これは3つの
特殊な inode、即ち DAT 向け inode、cpfile と sufile を含みます。通常フ
ァイル向け、ディレクトリ、シンボリックリンクと他のスペシャルファイル向
けの inode は ifile に格納されます。ifile 自体の inode は cpfile の対応
するチェックポイントエントリに格納されています。まとめると、NILFS2 ファ
イル間の階層関係は以下のように描かれます。

#  Super block (SB)
#       |
#       v
#  Super root block (the latest cno=xx)
#       |-- DAT
#       |-- sufile
#       `-- cpfile
#              |-- ifile (cno=c1)
#              |-- ifile (cno=c2) ---- file (ino=i1)
#              :        :          |-- file (ino=i2)
#              `-- ifile (cno=xx)  |-- file (ino=i3)
#                                  :        :
#                                  `-- file (ino=yy)
#                                    ( regular file, directory, or symlink )
  スーパーブロック (SB)
       |
       v
  スーパールートブロック (最新の cno=xx)
       |-- DAT
       |-- sufile
       `-- cpfile
              |-- ifile (cno=c1)
              |-- ifile (cno=c2) ---- ファイル (ino=i1)
              :        :          |-- ファイル (ino=i2)
              `-- ifile (cno=xx)  |-- ファイル (ino=i3)
                                  :        :
                                  `-- ファイル (ino=yy)
                                    ( 通常のファイル、ディレクトリ、シ
				    ンボリックリンク )

#For detail on the format of each file, please see include/linux/nilfs2_fs.h.
各ファイルのフォーマットの詳細については、include/linux/nilfs2_fs.h を
参照ください。

---------- >8 ---------- >8
-- 
Seiji Kaneko


JF-gofer メーリングリストの案内