]> wimlib.net Git - wimlib/blob - doc/imagex-capture.1.in
f17f0e6267a1c7fa18640bf05db1382cb1c12a7d
[wimlib] / doc / imagex-capture.1.in
1 .TH IMAGEX "1" "March 2013" "imagex (wimlib) wimlib @VERSION@" "User Commands"
2 .SH NAME
3 imagex-capture, imagex-append \- Capture a WIM image from a directory tree
4
5 .SH SYNOPSIS
6 \fBimagex capture\fR \fISOURCE\fR \fIWIMFILE\fR [\fIIMAGE_NAME\fR] \
7 [\fIDESCRIPTION\fR] [\fIOPTION\fR]...
8 .br
9 \fBimagex append\fR \fISOURCE\fR \fIWIMFILE\fR [\fIIMAGE_NAME\fR] \
10 [\fIDESCRIPTION\fR] [\fIOPTION\fR]...
11
12 .SH DESCRIPTION
13 .PP
14
15 The \fBimagex capture\fR and \fBimagex append\fR commands create a Windows
16 Imaging (WIM) image from a directory tree.  The \fBimagex capture\fR command
17 creates a new WIM file containing the captured image, while the \fBimagex
18 append\fR command appends the captured image to an existing WIM file.
19
20 A WIM image is an independent directory tree in the WIM file.  A WIM file may
21 contain any number of separate images.  However, files are stored only one time
22 in the entire WIM, regardless of how many images the file appears in.
23
24 \fISOURCE\fR specifies the location of the files to create the new WIM image
25 from.  If \fISOURCE\fR is a directory, the WIM image is captured from that
26 directory.  Alternatively, \fISOURCE\fR is a regular file or block device, it is
27 interpreted as a NTFS volume from which a WIM image is to be captured.  Still
28 alternatively, if the \fB--source-list\fR option is given, \fISOURCE\fR is
29 interpreted as a file that itself provides a list of files and directories to
30 include in the new WIM image.
31
32 \fIIMAGE_NAME\fR and \fIDESCRIPTION\fR specify the name and description of the
33 new image.  If \fIIMAGE_NAME\fR is not given, it is taken to be the same as the
34 base name of \fISOURCE\fR.  If \fIDESCRIPTION\fR is not given, no description is
35 given to the new image.
36
37 .SH NORMAL MODE
38
39 The normal image capture mode is entered when \fISOURCE\fR specifies a
40 directory.  The WIM image will be captured from the directory tree rooted at
41 this directory.  The directory may be on any type of filesystem.
42
43 In this normal image capture mode, we capture the following information from the
44 directory tree:
45
46 .IP \[bu] 4
47 The "normal" name and contents of each file and directory
48 .IP \[bu]
49 File and directory creation, access, and modification timestamps to the nearest
50 100 nanoseconds, if supported by the underlying filesystem
51 .IP \[bu]
52 Hard links and symbolic links
53
54 .PP
55
56 However, in the normal image capture mode, we do \fInot\fR capture the following
57 information from the directory tree:
58
59 .IP \[bu] 4
60 File permissions.  The resulting WIM image will not contain any security
61 descriptors because the format of the security descriptors is Windows-specific,
62 and they cannot contain UNIX file modes.  (Exception: see the \fB--unix-data\fR
63 option.)
64
65 .IP \[bu]
66 No alternate data streams will be captured, since these do not exist on
67 POSIX-compliant filesystems.  The resulting WIM image will not contain any
68 alternate data streams.
69
70 .SH NTFS MODE
71
72 A special image capture mode is entered when \fISOURCE\fR is a regular file or
73 block device.  \fISOURCE\fR is interpreted as an NTFS volume and opened using
74 libntfs-3g.  If successful, a WIM image is captured containing the contents of
75 the NTFS volume, including NTFS-specific data.
76
77 Please note that the NTFS image capture mode is \fInot\fR entered if
78 \fISOURCE\fR is a directory, even if a NTFS filesystem is mounted on
79 \fISOURCE\fR.  You must specify the NTFS volume itself (and it must be
80 unmounted, and you must have permission to read from it).
81
82 More specifically, in this mode, we capture the following types of information
83 from the NTFS volume:
84
85 .IP \[bu] 4
86 All data streams of all files, including the un-named data stream as well as all
87 named data streams.
88 .IP \[bu]
89 Reparse points, including symbolic links, junction points, and other reparse
90 points.
91 .IP \[bu]
92 File and directory creation, access, and modification timestamps from NTFS
93 inodes (these have a resolution of 100 nanoseconds).
94 .IP \[bu]
95 The security descriptor for each NTFS inode.
96 .IP \[bu]
97 File attribute flags.
98 .IP \[bu]
99 All names of all files, including names in the Win32 namespace, DOS namespace,
100 Win32+DOS namespace, and POSIX namespace.  This includes hard links.
101
102 .SH SOURCE LIST MODE
103
104 Yet another capture mode is entered when the \fB--source-list\fR option is
105 given.  It is essentially an extension of the \fBNORMAL MODE\fR that allows
106 multiple files or directories to be incorporated into a WIM image in a single
107 command.  See the documentation for \fB--source-list\fR below.
108
109 .SH OPTIONS
110 .TP 6
111 \fB--boot\fR
112 Specifies that the new image is to be made the bootable image of the WIM archive.
113 .TP
114 \fB--check\fR
115 Include an integrity table in the new WIM file or the modified WIM file.  If
116 this option is not specified, no integrity table is included in \fIWIMFILE\fR,
117 even if there was one before in the case of \fBimagex append\fR.
118 .TP
119 \fB--compress\fR=\fITYPE\fR
120 Specifies the compression type for the new WIM file.  This flag is only valid
121 for \fBimagex capture\fR, since the compression mode for \fBimagex append\fR
122 must be the same as that of the existing WIM.  \fITYPE\fR may be "none",
123 "maximum", or "fast".  By default, it is "fast".
124
125 You may also specify the actual names of the compression algorithms, "XPRESS"
126 and "LZX", instead of "fast" and "maximum", respectively.
127 .TP
128 \fB--threads\fR=\fINUM_THREADS\fR
129 Number of threads to use for compressing data.  Default: autodetect (number of
130 processors).  Note: if creating or appending to an uncompressed WIM, additional
131 threads will not be used, regardless of this parameter, since no compression
132 needs to be done in this case.
133 .TP
134 \fB--rebuild\fR
135 For \fBimagex append\fR: rebuild the entire WIM rather than appending the new
136 data to the end of it.  Rebuilding the WIM is slower, but will save a little bit
137 of space that would otherwise be left as a hole in the WIM.  Also see \fBimagex
138 optimize\fR.
139 .TP
140 \fB--flags\fR=\fIEDITIONID\fR
141 Specify a string to use in the <FLAGS> element of the XML data for the new
142 image.
143 .TP
144 \fB--verbose\fR
145 Print the names of files and directories as they are captured, as well as a few
146 other informational messages.
147 .TP
148 \fB--dereference\fR
149 Follow symlinks; archive and dump the files they point to.  (The default is to
150 archive the symlinks themselves.)  This flag is only valid in the normal image
151 capture mode.
152 .TP
153 \fB--config\fR=\fIFILE\fR
154 Specifies a configuration file for capturing the new image.  The configuration
155 file specifies files that are to be treated specially during the image capture.
156
157 The format of the configuration file is a number of sections containing file
158 globs one per line, where each section begins with the tag [ExclusionList],
159 [ExclusionException], [CompressionExclusionList], or [AlignmentList].
160 Currently, only the [ExclusionList] and [ExclusionException] sections are
161 implemented.  The [ExclusionList] section specifies a list of file globs to
162 exclude from capture, while the [ExclusionException] section specifies a list of
163 file globs to include in the capture even if the matched file or directory name
164 also appears in the [ExclusionList].
165
166 Relative globs with only one path component match against a filename in any
167 directory.  Relative globs with multiple path components, as well as absolute
168 globs, are treated as paths starting at the root directory of capture, or the
169 root of the NTFS volume for NTFS capture mode.  If a directory is matched by a
170 glob in the [ExclusionList], the entire directory tree rooted at that directory
171 is excluded from the capture, unless \fB--dereference\fR is specified and there
172 is another path into that directory through a symbolic link.
173
174 For compatibility with Windows, the path separators in the globs may be either
175 forward slashes or backslashes, and the line separators may be either UNIX-style
176 or DOS-style.  However, globs with spaces in them currently must not be quoted.
177 Empty lines are ignored.
178
179 If this option is not specified the following default configuration file is
180 used:
181
182 .RS
183 .RS
184 .PP
185 .nf
186 [ExclusionList]
187 \\$ntfs.log
188 \\hiberfil.sys
189 \\pagefile.sys
190 \\System Volume Information
191 \\RECYCLER
192 \\Windows\\CSC
193
194 [CompressionExclusionList]
195 *.mp3
196 *.zip
197 *.cab
198 \\WINDOWS\\inf\\*.pnf
199 .RE
200 .RE
201
202 .TP
203 \fB--unix-data\fR
204 Store the UNIX owner, group, and mode of regular files, symbolic links, and
205 directories.  This is done by adding a special alternate data stream to each
206 directory entry that contains this information.  Please note that this flag is
207 for convenience only, in case you want to use \fBimagex\fR to archive files on
208 UNIX.  Microsoft's software will not understand this special information.
209 .TP
210 \fB--source-list\fR
211 \fBimagex capture\fR and \fBimagex append\fR, as of wimlib 1.2.7, support a new
212 option to create a WIM image from multiple files or directories.  When
213 \fB--source-list\fR is specified, the \fISOURCE\fR argument specifies the name
214 of a text file, each line of which is either 1 or 2 whitespace separated
215 filenames.  The first filename, the source, specifies the path to a file or
216 directory to capture into the WIM image.  It may be either absolute or relative
217 to the current working directory.  The second filename, if provided, is the
218 target and specifies the path  in the WIM image that this file or directory will
219 be saved as.  Leading and trailing slashes are ignored.  "/" indicates that
220 the directory is to become the root of the WIM image.  If not specified, the
221 target string defaults to the same as the source string.
222
223 An example is as follows:
224
225 .RS
226 .RS
227 .PP
228 .nf
229 # Make the WIM image from the 'winpe' directory
230 winpe   /
231
232 # Send the 'overlay' directory to '/overlay' in the WIM image
233 overlay /overlay
234
235 # Overlay a separate directory directly on the root of the WIM image.
236 # This is only legal if there are no conflicting files.
237 /data/stuff     /
238 .RE
239
240 Subdirectories in the WIM are created as needed.  Multiple source directories
241 may share the same target, which implies an overlay; however, an error is issued
242 if the same file appears in different overlays.
243
244 Filenames containing whitespace may be quoted with either single quotes or
245 double quotes.  Quotes may not be escaped.
246
247 Empty lines, and lines beginning with '#' followed by optional whitespace, are
248 ignored.
249
250 As a special case, if \fISOURCE\fR is "-" the source list is read from standard
251 input rather than an external file.
252
253 The NTFS capture mode cannot be used with \fB--source-list\fR.
254
255 .SH NOTES
256
257 \fBimage append\fR does not support appending an image to a split WIM.
258
259 The different capture modes only specify the data that is captured and don't
260 specify a special WIM format.  A WIM file can contain images captured using
261 different modes.  However, all images in a WIM must have the same compression
262 type, and \fBimagex\fR always enforces this.
263
264 \fBimagex\fR writes WIMs having the version number 0x10d00 and a compressed
265 stream chunk size of 32768.  The only WIMs I've seen that are different from
266 this are some pre-Vista WIMs that had a different version number.
267
268 Unless \fB--rebuild\fR is specified, aborting an \fBimagex append\fR command
269 mid-way through has a small chance of corrupting the WIM file.  However, a
270 precaution is taken against this, so it should be very unlikely.  In the event
271 of an aborted \fBimagex append\fR, \fBimagex optimize\fR may be run to remove
272 extra data that may have been partially appended to the physical WIM file but
273 not yet incorporated into the structure of the WIM.
274
275 Capturing or appending an image happens in two main phases: (1) scanning the
276 directory or NTFS volume to checksum all the files and determine the streams to
277 be written, and (2) writing the new streams to the WIM file.  Streams are not
278 stored in memory after (1), since there could easily be gigabytes of data;
279 instead, they are read again during step (2); however, duplicate streams in the
280 image, and streams already existing in any other image in the WIM, are not read
281 again.  In the future, it may be possible to introduce the ability to capture an
282 image with reading each file only one time, although this mode would have some
283 limitations--- for example, a stream might be compressed only to be thrown away
284 as a duplicate once it's been checksummed.
285
286 \fISOURCE\fR may be a symbolic link to a directory rather than a directory
287 itself.  However, additional symbolic links in subdirectories, or in additional
288 source directories not destined for the WIM image root with
289 (\fB--source-list\fR), are not dereferenced unless \fB--dereference\fR is
290 specified.
291
292 .SH EXAMPLES
293 Create a new WIM 'mywim.wim' from the directory 'somedir', using LZX compression and
294 including an integrity table:
295 .RS
296 .PP
297 imagex capture somedir mywim.wim --compress=maximum --check
298 .RE
299 .PP
300 Append an image to the WIM we just captured, but do it from a NTFS volume on the
301 partition /dev/sda2, and name the image "Windows 7" and give it a description.
302 You do not need to specify the compression type, because the WIM already is
303 using LZX compression and this cannot be changed.  You need to specify
304 \fB--check\fR if you don't want the integrity table to be discarded.
305 .RS
306 .PP
307 imagex append /dev/sda2 mywim.wim --check "Windows 7" "Warning: This operating
308 system has been approved by Bill Gates"
309 .RE
310 .PP
311
312 .SH SEE ALSO
313 .BR imagex (1)
314