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 file system metadata to a file
11 .RB [ \-r | \-Q " [" \-af ]]
42 program will save critical ext2, ext3, or ext4 file system metadata located on
44 to a file specified by
46 The image file may be examined by
52 option to those programs. This can assist an expert in recovering
53 catastrophically corrupted file systems.
55 It is a very good idea to create image files for all file systems on a
56 system and save the partition layout (which can be generated using the
58 command) at regular intervals \(em at boot time, and/or every week or so.
59 The image file should be stored on some file system other than
60 the file system whose data it contains, to ensure that this data is
61 accessible in the case where the file system has been badly damaged.
65 creates the image file as a sparse file, or in QCOW2 format. Hence, if
66 the sparse image file needs to be copied to another location, it should
67 either be compressed first or copied using the
69 option to the GNU version of
71 This does not apply to the QCOW2 image, which is not sparse.
73 The size of an ext2 image file depends primarily on the size of the
74 file systems and how many inodes are in use. For a typical 10 Gigabyte
75 file system, with 200,000 inodes in use out of 1.2 million inodes, the image
76 file will be approximately 35 Megabytes; a 4 Gigabyte file system with 15,000
77 inodes in use out of 550,000 inodes will result in a 3 Megabyte image file.
78 Image files tend to be quite compressible; an image file taking up 32 Megabytes
79 of space on disk will generally compress down to 3 or 4 Megabytes.
87 will be sent to standard output, so that the output can be piped to
88 another program, such as
90 (Note that this is currently only supported when
91 creating a raw image file using the
93 option, since the process of creating a normal image file, or QCOW2
95 requires random access to the file, which cannot be done using a
101 Include file data in the image file. Normally
103 only includes fs metadata, not regular file data. This option will
104 produce an image that is suitable to use to clone the entire FS or
105 for backup purposes. Note that this option only works with the
110 formats. In conjunction with the
112 option it is possible to clone all and only the used blocks of one
113 file system to another device/image file.
115 .BI \-b " superblock"
116 Get image from partition with broken primary superblock by using
117 the superblock located at file system block number
119 The partition is copied as-is including broken primary superblock.
122 Set the file system blocksize in bytes. Normally,
124 will search for the superblock at various different block sizes in an
125 attempt to find the appropriate blocksize. This search can be fooled in
126 some cases. This option forces e2fsck to only try locating the superblock
127 with a particular blocksize. If the superblock is not found, e2image will
128 terminate with a fatal error.
131 Compare each block to be copied from the source
133 to the corresponding block in the target
135 If both are already the same, the write will be skipped. This is
136 useful if the file system is being cloned to a flash-based storage device
137 (where reads are very fast and where it is desirable to avoid unnecessary
138 writes to reduce write wear on the device).
141 Override the read-only requirement for the source file system when saving
142 the image file using the
146 options. Normally, if the source file system is in use, the resulting image
147 file is very likely not going to be useful. In some cases where the source
148 file system is in constant use this may be better than no image at all.
151 install the metadata stored in the image file back to the device.
152 It can be used to restore the file system metadata back to the device
153 in emergency situations.
158 option should only be used as a desperation measure when other
159 alternatives have failed. If the file system has changed since the image
160 file was created, data
162 be lost. In general, you should make another full image backup of the
163 file system first, in case you wish to try other recovery strategies afterward.
166 Cause all image writes to be skipped, and instead only print the block
167 numbers that would have been written.
169 .BI \-o " src_offset"
170 Specify offset of the image to be read from the start of the source
176 .BI \-O " tgt_offset"
177 Specify offset of the image to be written from the start of the target
184 Show progress of image-file creation.
187 Create a QCOW2-format image file instead of a normal image file, suitable
188 for use by virtual machine images, and other tools that can use the
195 Create a raw image file instead of a normal image file. See
200 Scramble directory entries and zero out unused portions of the directory
201 blocks in the written image file to avoid revealing information about
202 the contents of the file system. However, this will prevent analysis of
203 problems related to hash-tree indexed directories.
208 option will create a raw image file, which differs
209 from a normal image file in two ways. First, the file system metadata is
210 placed in the same relative offset within
219 etc. can be run directly on the raw image file. In order to minimize
220 the amount of disk space consumed by the raw image file, it is
221 created as a sparse file. (Beware of copying or
222 compressing/decompressing this file with utilities that don't understand
223 how to create sparse files; the file will become as large as the
224 file system itself!) Secondly, the raw image file also includes indirect
225 blocks and directory blocks, which the standard image file does not have.
227 Raw image files are sometimes used when sending file systems to the maintainer
228 as part of bug reports to e2fsprogs. When used in this capacity, the
229 recommended command is as follows (replace
231 with the appropriate device for your system):
233 \fBe2image \-r /dev/hda1 \- | bzip2 > hda1.e2i.bz2\fR
235 This will only send the metadata information, without any data blocks.
236 However, the filenames in the directory blocks can still reveal
237 information about the contents of the file system that the bug reporter
238 may wish to keep confidential. To address this concern, the
240 option can be specified to scramble the filenames in the image.
242 Note that this will work even if you substitute
245 disk image, or QCOW2 image previously created by
248 .SH QCOW2 IMAGE FILES
251 option will create a QCOW2 image file instead of a normal, or raw image file.
252 A QCOW2 image contains all the information the raw image does, however unlike
253 the raw image it is not sparse. The QCOW2 image minimize the amount of space
254 used by the image by storing it in special format which packs data closely
255 together, hence avoiding holes while still minimizing size.
257 In order to send file system to the maintainer as a part of bug report to
258 e2fsprogs, use following commands (replace
260 with the appropriate device for your system):
262 \& \fBe2image \-Q /dev/hda1 hda1.qcow2\fR
264 \& \fBbzip2 -z hda1.qcow2\fR
266 This will only send the metadata information, without any data blocks.
271 option can be specified to scramble the file system names in the image.
273 Note that the QCOW2 image created by
275 is a regular QCOW2 image and can be processed by tools aware of QCOW2 format
279 You can convert a .qcow2 image into a raw image with:
281 \& \fBe2image \-r hda1.qcow2 hda1.raw\fR
284 This can be useful to write a QCOW2 image containing all data to a
285 sparse image file where it can be loop mounted, or to a disk partition.
286 Note that this may not work with QCOW2 images not generated by e2image.
289 Normally a file system starts at the beginning of a partition, and
291 is run on the partition. When working with image files, you don't
292 have the option of using the partition device, so you can specify
293 the offset where the file system starts directly with the
295 option. Similarly the
297 option specifies the offset that should be seeked to in the destination
298 before writing the file system.
300 For example, if you have a
302 image of a whole hard drive that contains an ext2 fs in a partition
303 starting at 1 MiB, you can clone that image to a block device with:
305 \& \fBe2image \-aro 1048576 img /dev/sda1\fR
308 Or you can clone a file system from a block device into an image file,
309 leaving room in the first MiB for a partition table with:
311 \& \fBe2image -arO 1048576 /dev/sda1 img\fR
314 If you specify at least one offset, and only one file, an in-place
315 move will be performed, allowing you to safely move the file system
316 from one offset to another.
320 was written by Theodore Ts'o (tytso@mit.edu).
324 is part of the e2fsprogs package and is available from
325 http://e2fsprogs.sourceforge.net.