blob: 4b75e6df106711838bd677639df8eb531ebb596e [file] [log] [blame]
Theodore Ts'o348e43d2001-05-03 14:43:43 +00001.\" -*- 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
Theodore Ts'oa7ac1df2003-08-24 17:56:41 -04007e2image \- Save critical ext2/ext3 filesystem data to a file
Theodore Ts'o348e43d2001-05-03 14:43:43 +00008.SH SYNOPSIS
9.B e2image
Theodore Ts'o6304baf2001-08-09 05:41:29 -040010[
Theodore Ts'od851ed32005-01-19 00:26:43 -050011.B \-rsI
Theodore Ts'o6304baf2001-08-09 05:41:29 -040012]
Theodore Ts'o348e43d2001-05-03 14:43:43 +000013.I device
14.I image-file
15.SH DESCRIPTION
Theodore Ts'o0edb4d82001-05-03 16:30:48 +000016The
Theodore Ts'o348e43d2001-05-03 14:43:43 +000017.B e2image
Theodore Ts'o0edb4d82001-05-03 16:30:48 +000018program will save critical filesystem data on the ext2 filesystem located on
Theodore Ts'o0edb4d82001-05-03 16:30:48 +000019.I device
20to a file specified by
21.IR image-file .
22The image file may be examined by
23.B dumpe2fs
24and
25.BR debugfs ,
26by using the
27.B \-i
28option to those programs. This can be used by an expert in assisting
29the recovery of catastrophically corrupted filesystems. In the future,
30e2fsck will be enhanced to be able to use the image file to help
31recover a badly damaged filesystem.
32.PP
Theodore Ts'o1c1e0042001-08-09 06:04:32 -040033If
34.I image-file
Theodore Ts'o11d1e612004-12-01 12:42:33 -050035is \-, then the output of
Theodore Ts'o1c1e0042001-08-09 06:04:32 -040036.B e2image
Theodore Ts'o8ac59292004-03-08 14:18:56 -050037will be sent to standard output, so that the output can be piped to
38another program, such as
39.BR gzip (1).
40(Note that is currently only supported when
41creating a raw image file using the
42.B \-r
43option, since the process of creating a normal image file currently
44requires random-access access to the file, which can not be done using a
45pipe. This restriction will hopefully be lifted in a future version of
46.BR e2image .)
Theodore Ts'o1c1e0042001-08-09 06:04:32 -040047.PP
Theodore Ts'o0edb4d82001-05-03 16:30:48 +000048It is a very good idea to periodically (at boot time and
49every week or so) to create image files for all of
50filesystems on a system, as well as saving the partition
51layout (which can be generated using the using
Theodore Ts'o11d1e612004-12-01 12:42:33 -050052.B fdisk \-l
Theodore Ts'o0edb4d82001-05-03 16:30:48 +000053command). Ideally the image file should be stored on some filesystem
54other that
55the filesystem whose data it contains, to ensure that its data is
56accessible in the case where the filesystem has been badly damaged.
57.PP
58To save disk space,
59.B e2image
60creates the image file as a sparse file.
61Hence, if the image file
62needs to be copied to another location, it should
63either be compressed first or copied using the
Theodore Ts'o11d1e612004-12-01 12:42:33 -050064.B \-\-sparse=always
Theodore Ts'o0edb4d82001-05-03 16:30:48 +000065option to GNU version of
66.BR cp .
67.PP
68The size of an ext2 image file depends primarily on the size of the
69filesystems and how many inodes are in use. For a typical 10 gigabyte
70filesystem, with 200,000 inodes in use out of 1.2 million inodes, the
71image file be approximately 35 megabytes; a 4 gigabyte filesystem with
7215,000 inodes in use out of 550,000 inodes will result in a 3 megabyte
73image file. Image files tend to be quite
Theodore Ts'o6304baf2001-08-09 05:41:29 -040074compressible; an image file taking up 32 megabytes of space on
Theodore Ts'o0edb4d82001-05-03 16:30:48 +000075disk will generally compress down to 3 or 4 megabytes.
Theodore Ts'o348e43d2001-05-03 14:43:43 +000076.PP
Theodore Ts'od851ed32005-01-19 00:26:43 -050077.SH RESTORING FILESYSTEM METADATA USING AN IMAGE FILE
78.PP
79The
80.B \-I
81option will cause e2image to install the metadata stored in the image
82file back to the device. It can be used to restore the filesystem metadata
83back to the device in emergency situations.
84.PP
85.B WARNING!!!!
86The
87.B \-I
88option should only be used as desperation measure when other
89alternatives have failed. If the filesystem has changed since the image
90file was created, data
91.B will
92be lost. In general, you should make a full image
93backup of the filesystem first, in case you wish to try other recovery
94strategies afterwards.
95.PP
96.SH RAW IMAGE FILES
97The
98.B \-r
99option will create a raw image file instead of a normal image file.
100A raw image file differs
101from a normal image file in two ways. First, the filesystem metadata is
102placed in the proper position so that e2fsck, dumpe2fs, debugfs,
103etc. can be run directly on the raw image file. In order to minimize
104the amount of disk space consumed by a raw image file, the file is
105created as a sparse file. (Beware of copying or
106compressing/decompressing this file with utilities that don't understand
107how to create sparse files; the file will become as large as the
108filesystem itself!) Secondly, the raw image file also includes indirect
109blocks and directory blocks, which the standard image file does not have,
110although this may change in the future.
111.PP
112Raw image files are sometimes used when sending filesystems to as part
113of bug reports to e2fsprogs. When used in this capacity, the
114recommended command is (replace hda1 with appropriate device):
115.PP
116.br
117\ \fBe2image -r /dev/hda1 - | bzip2 > hda1.e2i.bz2\fR
118.PP
119This will only send the metadata information, without any data blocks.
120However, the filenames in the directory blocks can still reveal
121information about the contents of the filesystem that the bug reporter
122may wish to keep confidential. To address this concern, the
123.B \-s
124option can be specified. This will cause
125.B e2image
126to scramble directory entries and zero out any unused portions
127of the directory blocks before writing them to the image file.
128.PP
Theodore Ts'o348e43d2001-05-03 14:43:43 +0000129.SH AUTHOR
Theodore Ts'o0edb4d82001-05-03 16:30:48 +0000130.B e2image
Theodore Ts'o348e43d2001-05-03 14:43:43 +0000131was written by Theodore Ts'o (tytso@mit.edu).
132.SH AVAILABILITY
133.B e2image
Theodore Ts'o11d1e612004-12-01 12:42:33 -0500134is part of the e2fsprogs package and is available from
Theodore Ts'o348e43d2001-05-03 14:43:43 +0000135http://e2fsprogs.sourceforge.net.
136.SH SEE ALSO
137.BR dumpe2fs (8),
138.BR debugfs (8)
139