]> wimlib.net Git - wimlib/blob - doc/imagex-capture.1.in
1323f4fe306219f1ae63ecf766efb61febd499d9
[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, if \fISOURCE\fR is a regular file or block device, it
27 is 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 using a single
107 \fBimagex capture\fR command.  See the documentation for \fB--source-list\fR
108 below.
109
110 .SH OPTIONS
111 .TP 6
112 \fB--boot\fR
113 Specifies that the new image is to be made the bootable image of the WIM archive.
114 .TP
115 \fB--check\fR
116 Include an integrity table in the new WIM file or the modified WIM file.  If
117 this option is not specified, no integrity table is included in \fIWIMFILE\fR,
118 even if there was one before in the case of \fBimagex append\fR.
119 .TP
120 \fB--compress\fR=\fITYPE\fR
121 Specifies the compression type for the new WIM file.  This flag is only valid
122 for \fBimagex capture\fR, since the compression mode for \fBimagex append\fR
123 must be the same as that of the existing WIM.  \fITYPE\fR may be "none",
124 "maximum", or "fast".  By default, it is "fast".
125
126 You may also specify the actual names of the compression algorithms, "XPRESS"
127 and "LZX", instead of "fast" and "maximum", respectively.
128 .TP
129 \fB--threads\fR=\fINUM_THREADS\fR
130 Number of threads to use for compressing data.  Default: autodetect (number of
131 processors).  Note: if creating or appending to an uncompressed WIM, additional
132 threads will not be used, regardless of this parameter, since no compression
133 needs to be done in this case.
134 .TP
135 \fB--rebuild\fR
136 For \fBimagex append\fR: rebuild the entire WIM rather than appending the new
137 data to the end of it.  Rebuilding the WIM is slower, but will save a little bit
138 of space that would otherwise be left as a hole in the WIM.  Also see \fBimagex
139 optimize\fR.
140 .TP
141 \fB--flags\fR=\fIEDITIONID\fR
142 Specify a string to use in the <FLAGS> element of the XML data for the new
143 image.
144 .TP
145 \fB--verbose\fR
146 Print the names of files and directories as they are captured, as well as a few
147 other informational messages.
148 .TP
149 \fB--dereference\fR
150 Follow symlinks; archive and dump the files they point to.  (The default is to
151 archive the symlinks themselves.)  This flag is only valid in the normal image
152 capture mode.
153 .TP
154 \fB--config\fR=\fIFILE\fR
155 Specifies a configuration file for capturing the new image.  The configuration
156 file specifies files that are to be treated specially during the image capture.
157
158 The format of the configuration file is a number of sections containing file
159 globs one per line, where each section begins with the tag [ExclusionList],
160 [ExclusionException], [CompressionExclusionList], or [AlignmentList].
161 Currently, only the [ExclusionList] and [ExclusionException] sections are
162 implemented.  The [ExclusionList] section specifies a list of file globs to
163 exclude from capture, while the [ExclusionException] section specifies a list of
164 file globs to include in the capture even if the matched file or directory name
165 also appears in the [ExclusionList].
166
167 Relative globs with only one path component match against a filename in any
168 directory.  Relative globs with multiple path components, as well as absolute
169 globs, are treated as paths starting at the root directory of capture, or the
170 root of the NTFS volume for NTFS capture mode.  If a directory is matched by a
171 glob in the [ExclusionList], the entire directory tree rooted at that directory
172 is excluded from the capture, unless \fB--dereference\fR is specified and there
173 is another path into that directory through a symbolic link.
174
175 For compatibility with Windows, the path separators in the globs may be either
176 forward slashes or backslashes, and the line separators may be either UNIX-style
177 or DOS-style.  However, globs with spaces in them currently must not be quoted.
178 Empty lines are ignored.
179
180 If this option is not specified the following default configuration file is
181 used:
182
183 .RS
184 .RS
185 .PP
186 .nf
187 [ExclusionList]
188 \\$ntfs.log
189 \\hiberfil.sys
190 \\pagefile.sys
191 \\System Volume Information
192 \\RECYCLER
193 \\Windows\\CSC
194
195 [CompressionExclusionList]
196 *.mp3
197 *.zip
198 *.cab
199 \\WINDOWS\\inf\\*.pnf
200 .RE
201 .RE
202
203 .TP
204 \fB--unix-data\fR
205 Store the UNIX owner, group, and mode of regular files, symbolic links, and
206 directories.  This is done by adding a special alternate data stream to each
207 directory entry that contains this information.  Please note that this flag is
208 for convenience only, in case you want to use \fBimagex\fR to archive files on
209 UNIX.  Microsoft's software will not understand this special information.
210 .TP
211 \fB--source-list\fR
212 \fBimagex capture\fR and \fBimagex append\fR, as of wimlib 1.2.7, support a new
213 option to create a WIM image from multiple files or directories.  When
214 \fB--source-list\fR is specified, the \fISOURCE\fR argument specifies the name
215 of a text file, each line of which is either 1 or 2 whitespace separated
216 filenames.  The first filename, the source, specifies the path to a file or
217 directory to capture into the WIM image.  It may be either absolute or relative
218 to the current working directory.  The second filename, if provided, is the
219 target and specifies the path  in the WIM image that this file or directory will
220 be saved as.  Leading and trailing slashes are ignored.  "/" indicates that
221 the directory is to become the root of the WIM image.  If not specified, the
222 target string defaults to the same as the source string.
223
224 An example is as follows:
225
226 .RS
227 .RS
228 .PP
229 .nf
230 # Make the WIM image from the 'winpe' directory
231 winpe   /
232
233 # Send the 'overlay' directory to '/overlay' in the WIM image
234 overlay /overlay
235
236 # Overlay a separate directory directly on the root of the WIM image.
237 # This is only legal if there are no conflicting files.
238 /data/stuff     /
239 .RE
240
241 Subdirectories in the WIM are created as needed.  Multiple source directories
242 may share the same target, which implies an overlay; however, an error is issued
243 if the same file appears in different overlays.
244
245 Filenames containing whitespace may be quoted with either single quotes or
246 double quotes.  Quotes may not be escaped.
247
248 Lines consisting only of whitespace and lines beginning with '#' preceded by
249 optional whitespace are ignored.
250
251 As a special case, if \fISOURCE\fR is "-", the source list is read from standard
252 input rather than an external file.
253
254 The NTFS capture mode cannot be used with \fB--source-list\fR, as only capturing
255 a full NTFS volume is supported.
256
257 .SH NOTES
258
259 \fBimage append\fR does not support appending an image to a split WIM.
260
261 The different capture modes only specify the data that is captured and don't
262 specify a special WIM format.  A WIM file can contain images captured using
263 different modes.  However, all images in a WIM must have the same compression
264 type, and \fBimagex\fR always enforces this.
265
266 \fBimagex\fR writes WIMs having the version number 0x10d00 and a compressed
267 stream chunk size of 32768.  The only WIMs I've seen that are different from
268 this are some pre-Vista WIMs that had a different version number.
269
270 Unless \fB--rebuild\fR is specified, aborting an \fBimagex append\fR command
271 mid-way through has a small chance of corrupting the WIM file.  However, a
272 precaution is taken against this, so it should be very unlikely.  In the event
273 of an aborted \fBimagex append\fR, \fBimagex optimize\fR may be run to remove
274 extra data that may have been partially appended to the physical WIM file but
275 not yet incorporated into the structure of the WIM.
276
277 Capturing or appending an image happens in two main phases: (1) scanning the
278 directory or NTFS volume to checksum all the files and determine the streams to
279 be written, and (2) writing the new streams to the WIM file.  Streams are not
280 stored in memory after (1), since there could easily be gigabytes of data;
281 instead, they are read again during step (2); however, duplicate streams in the
282 image, and streams already existing in any other image in the WIM, are not read
283 again.  In the future, it may be possible to introduce the ability to capture an
284 image with reading each file only one time, although this mode would have some
285 limitations--- for example, a stream might be compressed only to be thrown away
286 as a duplicate once it's been checksummed.
287
288 \fISOURCE\fR may be a symbolic link to a directory rather than a directory
289 itself.  However, additional symbolic links in subdirectories, or in additional
290 source directories not destined for the WIM image root (with
291 \fB--source-list\fR), are not dereferenced unless \fB--dereference\fR is
292 specified.
293
294 .SH EXAMPLES
295 Create a new WIM 'mywim.wim' from the directory 'somedir', using LZX compression and
296 including an integrity table:
297 .RS
298 .PP
299 imagex capture somedir mywim.wim --compress=maximum --check
300 .RE
301 .PP
302 Append an image to the WIM we just captured, but do it from a NTFS volume on the
303 partition /dev/sda2, and name the image "Windows 7" and give it a description.
304 You do not need to specify the compression type, because the WIM already is
305 using LZX compression and this cannot be changed.  You need to specify
306 \fB--check\fR if you don't want the integrity table to be discarded.
307 .RS
308 .PP
309 imagex append /dev/sda2 mywim.wim --check "Windows 7" "Warning: This operating
310 system has been approved by Bill Gates"
311 .RE
312 .PP
313
314 .SH SEE ALSO
315 .BR imagex (1)
316