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