2 .\" Copyright 2001 by Theodore Ts'o. All Rights Reserved.
3 .\" This file may be copied under the terms of the GNU Public License.
5 .TH E2IMAGE 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
7 e2image \- Save critical ext2/ext3/ext4 filesystem metadata to a file
52 program will save critical ext2, ext3, or ext4 filesystem metadata located on
54 to a file specified by
56 The image file may be examined by
62 option to those programs. This can assist an expert in
63 recovering catastrophically corrupted filesystems. In the future,
64 e2fsck will be enhanced to be able to use the image file to help
65 recover a badly damaged filesystem.
67 When saving an e2image for debugging purposes, using either the
71 options, the filesystem must be unmounted or be mounted read/only, in order
72 for the image file to be in a consistent state. This requirement can be
75 option, but the resulting image file is very likely not going to be useful.
79 is \-, then the output of
81 will be sent to standard output, so that the output can be piped to
82 another program, such as
84 (Note that this is currently only supported when
85 creating a raw image file using the
87 option, since the process of creating a normal image file, or QCOW2
89 requires random access to the file, which cannot be done using a
90 pipe. This restriction will hopefully be lifted in a future version of
93 It is a very good idea to create image files for all of
94 filesystems on a system and save the partition
95 layout (which can be generated using the
97 command) at regular intervals --- at boot time, and/or every week or so.
98 The image file should be stored on some filesystem other than
99 the filesystem whose data it contains, to ensure that this data is
100 accessible in the case where the filesystem has been badly damaged.
104 creates the image file as a sparse file, or in QCOW2 format.
105 Hence, if the sparse image file
106 needs to be copied to another location, it should
107 either be compressed first or copied using the
109 option to the GNU version of
111 This does not apply to the QCOW2 image, which is not sparse.
113 The size of an ext2 image file depends primarily on the size of the
114 filesystems and how many inodes are in use. For a typical 10 gigabyte
115 filesystem, with 200,000 inodes in use out of 1.2 million inodes, the
116 image file will be approximately 35 megabytes; a 4 gigabyte filesystem with
117 15,000 inodes in use out of 550,000 inodes will result in a 3 megabyte
118 image file. Image files tend to be quite
119 compressible; an image file taking up 32 megabytes of space on
120 disk will generally compress down to 3 or 4 megabytes.
122 .SH RESTORING FILESYSTEM METADATA USING AN IMAGE FILE
126 option will cause e2image to install the metadata stored in the image
127 file back to the device. It can be used to restore the filesystem metadata
128 back to the device in emergency situations.
133 option should only be used as a desperation measure when other
134 alternatives have failed. If the filesystem has changed since the image
135 file was created, data
137 be lost. In general, you should make a full image
138 backup of the filesystem first, in case you wish to try other recovery
139 strategies afterwards.
144 option will create a raw image file instead of a normal image file.
145 A raw image file differs
146 from a normal image file in two ways. First, the filesystem metadata is
147 placed in the proper position so that e2fsck, dumpe2fs, debugfs,
148 etc.\& can be run directly on the raw image file. In order to minimize
149 the amount of disk space consumed by a raw image file, the file is
150 created as a sparse file. (Beware of copying or
151 compressing/decompressing this file with utilities that don't understand
152 how to create sparse files; the file will become as large as the
153 filesystem itself!) Secondly, the raw image file also includes indirect
154 blocks and directory blocks, which the standard image file does not have,
155 although this may change in the future.
157 Raw image files are sometimes used when sending filesystems to the maintainer
158 as part of bug reports to e2fsprogs. When used in this capacity, the
159 recommended command is as follows (replace hda1 with the appropriate device):
162 \fBe2image \-r /dev/hda1 \- | bzip2 > hda1.e2i.bz2\fR
164 This will only send the metadata information, without any data blocks.
165 However, the filenames in the directory blocks can still reveal
166 information about the contents of the filesystem that the bug reporter
167 may wish to keep confidential. To address this concern, the
169 option can be specified. This will cause
171 to scramble directory entries and zero out any unused portions
172 of the directory blocks before writing the image file. However,
175 option will prevent analysis of problems related to hash-tree indexed
181 can be used to get image from partition with broken primary superblock.
182 The partition is copied as-is including broken primary superblock.
187 can be used to set superblock block size. Normally, e2fsck will search
188 for the superblock at various different block sizes in an attempt to find
189 the appropriate blocksize. This search can be fooled in some cases. This
190 option forces e2fsck to only try locating the superblock at a particular
191 blocksize. If the superblock is not found, e2fsck will terminate with a
194 Note that this will work even if you substitute "/dev/hda1" for another raw
195 disk image, or QCOW2 image previously created by
198 .SH QCOW2 IMAGE FILES
201 option will create a QCOW2 image file instead of a normal, or raw image file.
202 A QCOW2 image contains all the information the raw image does, however unlike
203 the raw image it is not sparse. The QCOW2 image minimize the amount of disk
204 space by storing data in special format with pack data closely together, hence
205 avoiding holes while still minimizing size.
207 In order to send filesystem to the maintainer as a part of bug report to
208 e2fsprogs, use following commands (replace hda1 with the appropriate device):
211 \ \fBe2image \-Q /dev/hda1 hda1.qcow2\fR
213 \ \fBbzip2 -z hda1.qcow2\fR
215 This will only send the metadata information, without any data blocks.
216 However, the filenames in the directory blocks can still reveal
217 information about the contents of the filesystem that the bug reporter
218 may wish to keep confidential. To address this concern, the
220 option can be specified. This will cause
222 to scramble directory entries and zero out any unused portions
223 of the directory blocks before writing the image file. However, the
225 option will prevent analysis of problems related to hash-tree indexed
228 Note that QCOW2 image created by
230 is regular QCOW2 image and can be processed by tools aware of QCOW2 format
234 You can convert a qcow2 image into a raw image with:
237 \ \fBe2image \-r hda1.qcow2 hda1.raw\fR
240 This can be useful to write a qcow2 image containing all data to a
241 sparse image file where it can be loop mounted, or to a disk partition.
242 Note that this may not work with qcow2 images not generated by e2image.
250 can be used same way as for raw images.
255 only includes fs metadata, not regular file data. The
257 option can be specified to include all data. This will
258 give an image that is suitable to use to clone the entire FS or
259 for backup purposes. Note that this option only works with the
260 raw or QCOW2 formats. The
262 switch may be given to show progress. If the file system is being
263 cloned to a flash-based storage device (where reads are very fast and
264 where it is desirable to avoid unnecessary writes to reduce write wear
267 option which cause e2image to try reading a block from the destination
268 to see if it is identical to the block which
270 is about to copy. If the block is already the same, the write can be
273 option will cause all of the writes to be no-ops, and print the blocks
274 that would have been written.
277 Normally a filesystem starts at the beginning of a partition, and
279 is run on the partition. When working with image files, you don't
280 have the option of using the partition device, so you can specify
281 the offset where the filesystem starts directly with the
283 option. Similarly the
285 option specifies the offset that should be seeked to in the destination
286 before writing the filesystem.
288 For example, if you have a
290 image of a whole hard drive that contains an ext2 fs in a partition
291 starting at 1 MiB, you can clone that fs with:
294 \ \fBe2image \-aro 1048576 img /dev/sda1\fR
297 Or you can clone a fs into an image file, leaving room in the first
298 MiB for a partition table with:
301 \ \fBe2image -arO 1048576 /dev/sda1 img\fR
304 If you specify at least one offset, and only one file, an in-place
305 move will be performed, allowing you to safely move the filesystem
306 from one offset to another.
309 was written by Theodore Ts'o (tytso@mit.edu).
312 is part of the e2fsprogs package and is available from
313 http://e2fsprogs.sourceforge.net.