]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - misc/e2image.8.in
libext2fs: checksum bg descriptors larger than 64 bytes
[thirdparty/e2fsprogs.git] / misc / e2image.8.in
CommitLineData
348e43dc
TT
1.\" -*- nroff -*-
2.\" Copyright 2001 by Theodore Ts'o. All Rights Reserved.
3.\" This file may be copied under the terms of the GNU Public License.
4.\"
5.TH E2IMAGE 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
6.SH NAME
4f858546 7e2image \- Save critical ext2/ext3/ext4 filesystem metadata to a file
348e43dc
TT
8.SH SYNOPSIS
9.B e2image
6304baf2 10[
0e51f5ae 11.B \-rsIQa
6304baf2 12]
348e43dc
TT
13.I device
14.I image-file
15.SH DESCRIPTION
0edb4d85 16The
348e43dc 17.B e2image
4780e870
TT
18program will save critical ext2, ext3, or ext4 filesystem metadata located on
19.I device
20to a file specified by
0edb4d85 21.IR image-file .
4780e870 22The image file may be examined by
0edb4d85
TT
23.B dumpe2fs
24and
25.BR debugfs ,
26by using the
27.B \-i
b7c1d202
TT
28option to those programs. This can assist an expert in
29recovering catastrophically corrupted filesystems. In the future,
0edb4d85
TT
30e2fsck will be enhanced to be able to use the image file to help
31recover a badly damaged filesystem.
32.PP
6c327e9c
CM
33When saving an e2image for debugging purposes, using either the
34.B \-r
35or
36.B \-Q
37options, the filesystem must be unmounted or be mounted read/only, in order
38for the image file to be in a consistent state. This requirement can be
39overriden using the
40.B -f
41option, but the resulting image file is very likely not going to be useful.
42.PP
4780e870 43If
1c1e0049 44.I image-file
4780e870 45is \-, then the output of
1c1e0049 46.B e2image
8ac59297 47will be sent to standard output, so that the output can be piped to
4780e870
TT
48another program, such as
49.BR gzip (1).
b7c1d202 50(Note that this is currently only supported when
4780e870 51creating a raw image file using the
8ac59297 52.B \-r
bf0449b1
LC
53option, since the process of creating a normal image file, or QCOW2
54image currently
b7c1d202 55requires random access to the file, which cannot be done using a
8ac59297
TT
56pipe. This restriction will hopefully be lifted in a future version of
57.BR e2image .)
1c1e0049 58.PP
b7c1d202
TT
59It is a very good idea to create image files for all of
60filesystems on a system and save the partition
4780e870 61layout (which can be generated using the
d851ed39 62.B fdisk \-l
b7c1d202 63command) at regular intervals --- at boot time, and/or every week or so.
d9781cee
TT
64The image file should be stored on some filesystem other than
65the filesystem whose data it contains, to ensure that this data is
d851ed39
TT
66accessible in the case where the filesystem has been badly damaged.
67.PP
4780e870 68To save disk space,
d851ed39 69.B e2image
bf0449b1
LC
70creates the image file as a sparse file, or in QCOW2 format.
71Hence, if the sparse image file
d851ed39 72needs to be copied to another location, it should
4780e870 73either be compressed first or copied using the
d851ed39 74.B \-\-sparse=always
4780e870 75option to the GNU version of
bf0449b1
LC
76.BR cp .
77This does not apply to the QCOW2 image, which is not sparse.
d851ed39
TT
78.PP
79The size of an ext2 image file depends primarily on the size of the
80filesystems and how many inodes are in use. For a typical 10 gigabyte
81filesystem, with 200,000 inodes in use out of 1.2 million inodes, the
b7c1d202 82image file will be approximately 35 megabytes; a 4 gigabyte filesystem with
d851ed39
TT
8315,000 inodes in use out of 550,000 inodes will result in a 3 megabyte
84image file. Image files tend to be quite
85compressible; an image file taking up 32 megabytes of space on
86disk will generally compress down to 3 or 4 megabytes.
87.PP
88.SH RESTORING FILESYSTEM METADATA USING AN IMAGE FILE
89.PP
4780e870
TT
90The
91.B \-I
8c6b6483 92option will cause e2image to install the metadata stored in the image
4780e870 93file back to the device. It can be used to restore the filesystem metadata
8c6b6483
TT
94back to the device in emergency situations.
95.PP
96.B WARNING!!!!
97The
4780e870 98.B \-I
b7c1d202 99option should only be used as a desperation measure when other
8c6b6483
TT
100alternatives have failed. If the filesystem has changed since the image
101file was created, data
102.B will
103be lost. In general, you should make a full image
104backup of the filesystem first, in case you wish to try other recovery
105strategies afterwards.
106.PP
d851ed39 107.SH RAW IMAGE FILES
4780e870 108The
6304baf2 109.B \-r
4780e870 110option will create a raw image file instead of a normal image file.
1c1e0049 111A raw image file differs
6304baf2
TT
112from a normal image file in two ways. First, the filesystem metadata is
113placed in the proper position so that e2fsck, dumpe2fs, debugfs,
4780e870 114etc.\& can be run directly on the raw image file. In order to minimize
6304baf2
TT
115the amount of disk space consumed by a raw image file, the file is
116created as a sparse file. (Beware of copying or
117compressing/decompressing this file with utilities that don't understand
118how to create sparse files; the file will become as large as the
119filesystem itself!) Secondly, the raw image file also includes indirect
d851ed39 120blocks and directory blocks, which the standard image file does not have,
6304baf2
TT
121although this may change in the future.
122.PP
b7c1d202
TT
123Raw image files are sometimes used when sending filesystems to the maintainer
124as part of bug reports to e2fsprogs. When used in this capacity, the
125recommended command is as follows (replace hda1 with the appropriate device):
0edb4d85 126.PP
d851ed39 127.br
4780e870 128 \fBe2image \-r /dev/hda1 \- | bzip2 > hda1.e2i.bz2\fR
0edb4d85 129.PP
4780e870 130This will only send the metadata information, without any data blocks.
d851ed39
TT
131However, the filenames in the directory blocks can still reveal
132information about the contents of the filesystem that the bug reporter
133may wish to keep confidential. To address this concern, the
134.B \-s
135option can be specified. This will cause
4780e870 136.B e2image
d851ed39 137to scramble directory entries and zero out any unused portions
b7c1d202 138of the directory blocks before writing the image file. However,
4780e870 139the
b7c1d202
TT
140.B \-s
141option will prevent analysis of problems related to hash-tree indexed
142directories.
348e43dc 143.PP
92dcfb76
LC
144Note that this will work even if you substitute "/dev/hda1" for another raw
145disk image, or QCOW2 image previously created by
146.BR e2image .
147.PP
bf0449b1
LC
148.SH QCOW2 IMAGE FILES
149The
150.B \-Q
151option will create a QCOW2 image file instead of a normal, or raw image file.
152A QCOW2 image contains all the information the raw image does, however unlike
153the raw image it is not sparse. The QCOW2 image minimize the amount of disk
154space by storing data in special format with pack data closely together, hence
155avoiding holes while still minimizing size.
156.PP
157In order to send filesystem to the maintainer as a part of bug report to
158e2fsprogs, use following commands (replace hda1 with the appropriate device):
159.PP
160.br
161\ \fBe2image \-Q /dev/hda1 hda1.qcow2\fR
162.br
163\ \fBbzip2 -z hda1.qcow2\fR
164.PP
165This will only send the metadata information, without any data blocks.
166However, the filenames in the directory blocks can still reveal
167information about the contents of the filesystem that the bug reporter
168may wish to keep confidential. To address this concern, the
169.B \-s
170option can be specified. This will cause
171.B e2image
172to scramble directory entries and zero out any unused portions
173of the directory blocks before writing the image file. However, the
174.B \-s
175option will prevent analysis of problems related to hash-tree indexed
176directories.
177.PP
178Note that QCOW2 image created by
179.B e2image
180is regular QCOW2 image and can be processed by tools aware of QCOW2 format
181such as for example
182.BR qemu-img .
183.PP
0e51f5ae
PS
184You can convert a qcow2 image into a raw image with:
185.PP
186.br
187\ \fBe2image \-r hda1.qcow2 hda1.raw\fR
188.br
189.PP
190This can be useful to write a qcow2 image containing all data to a
191sparse image file where it can be loop mounted, or to a disk partition.
192Note that this may not work with qcow2 images not generated by e2image.
193.PP
194.SH INCLUDING DATA
195Normally
196.B e2image
197only includes fs metadata, not regular file data. The
198.B \-a
199option can be specified to include all data. This will
ef21356f 200give an image that is suitable to use to clone the entire FS or
0e51f5ae
PS
201for backup purposes. Note that this option only works with the
202raw or QCOW2 formats.
203.PP
348e43dc 204.SH AUTHOR
4780e870 205.B e2image
348e43dc
TT
206was written by Theodore Ts'o (tytso@mit.edu).
207.SH AVAILABILITY
208.B e2image
4780e870 209is part of the e2fsprogs package and is available from
348e43dc
TT
210http://e2fsprogs.sourceforge.net.
211.SH SEE ALSO
212.BR dumpe2fs (8),
213.BR debugfs (8)
214