E2IMAGE(8) E2IMAGE(8) 名前 e2image - 重要な ext2/ext3 ファイルシステムメタデータをファイルに保存す る 書式 e2image [ -rsI ] device image-file 説明 e2image プログラムは、 device 上にある重要な ext2 または ext3 のファ イ ル システムのメタデータを指定されたファイル image-file に保存する。この イメージファイルは dumpe2fs や debugfs といったプログラムで -i オプショ ン を使えば検査できる。このプログラムは酷く破損したファイルシステムをエ キスパートが回復するときの手助けができる。将来的には、被害を受けたフ ァ イ ルシステムを回復する手助けとして、このイメージファイルを用いるように e2fsck を拡張する予定である。 image-file が - の場合、 e2image の出力は標準出力に送られる。これにより 、出力を gzip(1) のような他のプログラムにパイプすることができる。 (今の ところ、このオプションがサポートされているのは、 -r オプションを使っ て raw イメージファイルを作成する場合のみである点に注意すること。なぜなら 、今のところは通常のイメージファイルを作成する過程で、パイプを使って 行 う ことのできないファイルへのランダムアクセスが必要なためである。この制 限は将来のバージョンの e2image で取り除かれると期待される。) (ブート時や毎週といった) 一定の期間毎に、全てのファイルシステムのイメー ジファイルを作成したり、 (fdisk -l コマンドで生成される) パーティション のレイアウトを保存するのは、とても良い考えである。ファイルシステムが 被 害 を受けたときにイメージファイルデータにアクセスできることを保証するた めに、イメージファイルは中に入れたファイルシステムとは別のファイルシ ス テムに置いておくべきである。 デ ィ ス ク 容量を節約するため、 e2image はイメージファイルをスパースな (sparse) ファイルとして作成する。よって、イメージファイルを他へコピーす る ときには、前もって圧縮するか、 GNU 版の cp では --sparse=always オプ ションを使ってコピーするべきである。 ext2 イメージファイルの大きさは、ファイルシステムのサイズと使用している inode の 数 に 大 き く 依存する。典型的な 10 GB のファイルシステムで 1,200,000 個の inode のうち 200,000 個が使われている場合、イメージフ ァ イルの大きさは約 35 MB になるだろう。 4 GB のファイルシステムで 550,000 個の inode のうち 15,000 個が使用されている場合、イメージファイルの大き さは約 3 MB になるだろう。イメージファイルは (ファイルシステムと比べて) とても小さく圧縮できる傾向がある。ディスク上で 32 MB を使用しているイメ ージファイルは、一般に 3 〜 4 MB に圧縮される。 イメージファイルを使ったファイルシステムメタデータの復旧 -I オプションを指定すると、e2image はイメージファイルに格納されているメ タデータをデバイスにインストールし直す。これは緊急の場合に、ファイル シ ステムメタデータをデバイスに復旧するのに使用できる。 警告!!!! -I オプションは、他の方法が失敗した場合の最終手段としてのみ使 用すべきである。イメージファイルが作成された後でファイルシステムが変 更 さ れていると、データが失われるだろう。他の復旧手段を後で試そうと思う場 合は、通常はファイルシステムのフルイメージバックアップを作成すべきで あ る。 RAW イメージファイル -r オプションを使うと、通常のイメージファイルではなく、 raw イメージフ ァイルが作成される。 raw イメージファイルは、通常のイメージファイルと 2 つの点が異なる。 1 つ目は、ファイルシステムのメタデータが適切な位置に置 かれ、 e2fsck, dumpe2fs, debugfs などが raw イメージファイル上で直接 実 行できるという点である。 raw イメージファイルが使うディスクスペースを最 小化するため、このファイルはスパースなファイルとして作成される。 (ス パ ー スなファイルの作成が実装されていないユーティリティでこのファイルをコ ピー・圧縮・展開する場合は注意すること。ファイルがファイルシステム自 身 と 同じ大きさになってしまうだろう!) 2 つ目は、raw イメージファイルが間 接ブロックと間接データブロックを含んでいるという点である。現行のイメ ー ジ ファイルはこれらのブロックを含んでいないが、将来的には変更されるかも しれない。 raw イメージファイルは、e2fsprogs のバグレポートの一部としてメンテナ に フ ァイルシステムを送る場合に時々利用される。バグレポートで送る場合には 、以下のコマンドが推奨される (hda1 を適切なデバイスで置き換えること): e2image -r /dev/hda1 - | bzip2 > hda1.e2i.bz2 これにより、データブロックを含まないメタデータ情報のみを送ることがで き る 。しかしこれでも、ディレクトリブロック内のファイル名によって、バグ報 告者が秘密にしておきたいファイルシステムの内容についての情報が明らか に さ れてしまう。その心配を取り除くためには、 -s オプションを指定すること ができる。これにより e2image は、イメージファイルを書き込む前に、ディレ ク トリエントリをごちゃ混ぜにして、ディレクトリブロックの使用されていな い部分を 0 で埋める。ただし -s オプションはハッシュツリーにインデックス 化されたディレクトリについての問題の分析を妨げてしまう。 著者 e2image は Theodore Ts’o (tytso@mit.edu) が作成した。 入手方法 e2image は e2fsprogs パッケージの一部で、 http://e2fsprogs.source- forge.net から入手できる。 関連項目 dumpe2fs(8), debugfs(8) E2fsprogs version 1.39 May 2006 E2IMAGE(8)
E2IMAGE(8) E2IMAGE(8) NAME e2image - Save critical ext2/ext3/ext4 filesystem metadata to a file SYNOPSIS e2image [ -rsI ] device image-file DESCRIPTION The e2image program will save critical ext2, ext3, or ext4 filesystem metadata located on device to a file specified by image-file. The image file may be examined by dumpe2fs and debugfs, by using the -i option to those programs. This can assist an expert in recovering catastrophically corrupted filesystems. In the future, e2fsck will be enhanced to be able to use the image file to help recover a badly dam- aged filesystem. When saving an e2image for debugging purposes, using either the -r or -Q options, the filesystem must be unmounted or be mounted read/only, in order for the image file to be in a consistent state. This require- ment can be overridden using the -f option, but the resulting image file is very likely not going to be useful. If image-file is -, then the output of e2image will be sent to standard output, so that the output can be piped to another program, such as gzip(1). (Note that this is currently only supported when creating a raw image file using the -r option, since the process of creating a normal image file, or QCOW2 image currently requires random access to the file, which cannot be done using a pipe. This restriction will hopefully be lifted in a future version of e2image.) It is a very good idea to create image files for all of filesystems on a system and save the partition layout (which can be generated using the fdisk -l command) at regular intervals --- at boot time, and/or every week or so. The image file should be stored on some filesystem other than the filesystem whose data it contains, to ensure that this data is accessible in the case where the filesystem has been badly dam- aged. To save disk space, e2image creates the image file as a sparse file, or in QCOW2 format. Hence, if the sparse image file needs to be copied to another location, it should either be compressed first or copied using the --sparse=always option to the GNU version of cp. This does not apply to the QCOW2 image, which is not sparse. The size of an ext2 image file depends primarily on the size of the filesystems and how many inodes are in use. For a typical 10 gigabyte filesystem, with 200,000 inodes in use out of 1.2 million inodes, the image file will be approximately 35 megabytes; a 4 gigabyte filesystem with 15,000 inodes in use out of 550,000 inodes will result in a 3 megabyte image file. Image files tend to be quite compressible; an image file taking up 32 megabytes of space on disk will generally com- press down to 3 or 4 megabytes. RESTORING FILESYSTEM METADATA USING AN IMAGE FILE The -I option will cause e2image to install the metadata stored in the image file back to the device. It can be used to restore the filesystem metadata back to the device in emergency situations. WARNING!!!! The -I option should only be used as a desperation measure when other alternatives have failed. If the filesystem has changed since the image file was created, data will be lost. In general, you should make a full image backup of the filesystem first, in case you wish to try other recovery strategies afterwards. RAW IMAGE FILES The -r option will create a raw image file instead of a normal image file. A raw image file differs from a normal image file in two ways. First, the filesystem metadata is placed in the proper position so that e2fsck, dumpe2fs, debugfs, etc. can be run directly on the raw image file. In order to minimize the amount of disk space consumed by a raw image file, the file is created as a sparse file. (Beware of copying or compressing/decompressing this file with utilities that don’t under- stand how to create sparse files; the file will become as large as the filesystem itself!) Secondly, the raw image file also includes indi- rect blocks and directory blocks, which the standard image file does not have, although this may change in the future. Raw image files are sometimes used when sending filesystems to the maintainer as part of bug reports to e2fsprogs. When used in this capacity, the recommended command is as follows (replace hda1 with the appropriate device): e2image -r /dev/hda1 - | bzip2 > hda1.e2i.bz2 This will only send the metadata information, without any data blocks. However, the filenames in the directory blocks can still reveal infor- mation about the contents of the filesystem that the bug reporter may wish to keep confidential. To address this concern, the -s option can be specified. This will cause e2image to scramble directory entries and zero out any unused portions of the directory blocks before writing the image file. However, the -s option will prevent analysis of prob- lems related to hash-tree indexed directories. Note that this will work even if you substitute "/dev/hda1" for another raw disk image, or QCOW2 image previously created by e2image. QCOW2 IMAGE FILES The -Q option will create a QCOW2 image file instead of a normal, or raw image file. A QCOW2 image contains all the information the raw image does, however unlike the raw image it is not sparse. The QCOW2 image minimize the amount of disk space by storing data in special for- mat with pack data closely together, hence avoiding holes while still minimizing size. In order to send filesystem to the maintainer as a part of bug report to e2fsprogs, use following commands (replace hda1 with the appropriate device): e2image -Q /dev/hda1 hda1.qcow2 bzip2 -z hda1.qcow2 This will only send the metadata information, without any data blocks. However, the filenames in the directory blocks can still reveal infor- mation about the contents of the filesystem that the bug reporter may wish to keep confidential. To address this concern, the -s option can be specified. This will cause e2image to scramble directory entries and zero out any unused portions of the directory blocks before writing the image file. However, the -s option will prevent analysis of prob- lems related to hash-tree indexed directories. Note that QCOW2 image created by e2image is regular QCOW2 image and can be processed by tools aware of QCOW2 format such as for example qemu- img. AUTHOR e2image was written by Theodore Ts’o (tytso@mit.edu). AVAILABILITY e2image is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net. SEE ALSO dumpe2fs(8), debugfs(8) E2fsprogs version 1.41.12 May 2010 E2IMAGE(8)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa