]> wimlib.net Git - wimlib/blob - doc/imagex-capture.1.in
util.c: Print carriage return before warnings/errors
[wimlib] / doc / imagex-capture.1.in
1 .TH IMAGEX "1" "April 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--rpfix\fR, \fB--norpfix\fR
241 Set whether to fix targets of absolute symbolic links (reparse points in Windows
242 terminology) or not.  When enabled (\fB--rpfix\fR), absolute symbolic links that
243 point inside the directory tree being captured will be adjusted to be absolute
244 relative to the root of the directory tree being captured.  In addition,
245 absolute symbolic links that point outside the directory tree being captured
246 will be ignored and not be captured at all.  When disabled (\fB--norpfix\fR),
247 absolute symbolic links will be captured exactly as is.
248
249 The default behavior for \fBimagex capture\fR is equivalent to \fB--rpfix\fR.
250 The default behavior for \fBimagex append\fR will be \fB--rpfix\fR if reparse
251 point fixups have previously been done on \fIWIMFILE\fR, otherwise
252 \fB--norpfix\fR.
253
254 Links are fixed up on a per-source basis in the case of a multi-source capture
255 (\fB--source-list\fR specified), so you may wish to set \fB--norpfix\fR in that
256 case.
257 .TP
258 \fB--strict-acls\fR
259 In the Win32 native build of wimlib, fail immediately if the full security
260 descriptor of any file or directory cannot be read.  The default behavior
261 without this option is to first try omitting the SACL from the security
262 descriptor, then to try omitting the security descriptor entirely.  The purpose
263 of this is to capture as much data as possible without always requiring
264 Administrator privileges.  However, if you desire that all security descriptors
265 be captured exactly, you may with to provide this option, although the
266 Administrator should have permission to read everything anyway.
267 .TP
268 \fB--source-list\fR
269 \fB@IMAGEX_PROGNAME@ capture\fR and \fB@IMAGEX_PROGNAME@ append\fR, as of wimlib 1.3.0, support a new
270 option to create a WIM image from multiple files or directories.  When
271 \fB--source-list\fR is specified, the \fISOURCE\fR argument specifies the name
272 of a text file, each line of which is either 1 or 2 whitespace separated
273 filenames.  The first filename, the source, specifies the path to a file or
274 directory to capture into the WIM image.  It may be either absolute or relative
275 to the current working directory.  The second filename, if provided, is the
276 target and specifies the path  in the WIM image that this file or directory will
277 be saved as.  Leading and trailing slashes are ignored.  "/" indicates that
278 the directory is to become the root of the WIM image.  If not specified, the
279 target string defaults to the same as the source string.
280
281 An example is as follows:
282
283 .RS
284 .RS
285 .PP
286 .nf
287 # Make the WIM image from the 'winpe' directory
288 winpe   /
289
290 # Send the 'overlay' directory to '/overlay' in the WIM image
291 overlay /overlay
292
293 # Overlay a separate directory directly on the root of the WIM image.
294 # This is only legal if there are no conflicting files.
295 /data/stuff     /
296 .RE
297
298 Subdirectories in the WIM are created as needed.  Multiple source directories
299 may share the same target, which implies an overlay; however, an error is issued
300 if the same file appears in different overlays to the same directory.
301
302 Filenames containing whitespace may be quoted with either single quotes or
303 double quotes.  Quotes may not be escaped.
304
305 Lines consisting only of whitespace and lines beginning with '#' preceded by
306 optional whitespace are ignored.
307
308 As a special case, if \fISOURCE\fR is "-", the source list is read from standard
309 input rather than an external file.
310
311 The NTFS capture mode cannot be used with \fB--source-list\fR, as only capturing
312 a full NTFS volume is supported.
313
314 .SH NOTES
315
316 \fBimage append\fR does not support appending an image to a split WIM.
317
318 The different capture modes only specify the data that is captured and don't
319 specify a special WIM format.  A WIM file can contain images captured using
320 different modes.  However, all images in a WIM must have the same compression
321 type, and \fB@IMAGEX_PROGNAME@\fR always enforces this.
322
323 \fB@IMAGEX_PROGNAME@\fR writes WIMs having the version number 0x10d00 and a compressed
324 stream chunk size of 32768.  The only WIMs I've seen that are different from
325 this are some pre-Vista WIMs that had a different version number.
326
327 Unless \fB--rebuild\fR is specified, aborting an \fB@IMAGEX_PROGNAME@ append\fR command
328 mid-way through has a small chance of corrupting the WIM file.  However, a
329 precaution is taken against this, so it should be very unlikely.  In the event
330 of an aborted \fB@IMAGEX_PROGNAME@ append\fR, \fB@IMAGEX_PROGNAME@ optimize\fR may be run to remove
331 extra data that may have been partially appended to the physical WIM file but
332 not yet incorporated into the structure of the WIM.
333
334 Capturing or appending an image happens in two main phases: (1) scanning the
335 directory or NTFS volume to checksum all the files and determine the streams to
336 be written, and (2) writing the new streams to the WIM file.  Streams are not
337 stored in memory after (1), since there could easily be gigabytes of data;
338 instead, they are read again during step (2); however, duplicate streams in the
339 image, and streams already existing in any other image in the WIM, are not read
340 again.  In the future, it may be possible to introduce the ability to capture an
341 image with reading each file only one time, although this mode would have some
342 limitations--- for example, a stream might be compressed only to be thrown away
343 as a duplicate once it's been checksummed.
344
345 \fISOURCE\fR may be a symbolic link to a directory rather than a directory
346 itself.  However, additional symbolic links in subdirectories, or in additional
347 source directories not destined for the WIM image root (with
348 \fB--source-list\fR), are not dereferenced unless \fB--dereference\fR is
349 specified.
350
351 .SH EXAMPLES
352 Create a new WIM 'mywim.wim' from the directory 'somedir', using LZX compression and
353 including an integrity table:
354 .RS
355 .PP
356 @IMAGEX_PROGNAME@ capture somedir mywim.wim --compress=maximum --check
357 .RE
358 .PP
359 Append an image to the WIM we just captured, but do it from a NTFS volume on the
360 partition /dev/sda2 and name the image "Windows 7".  You do not need to specify
361 the compression type, because the WIM already is using LZX compression and this
362 cannot be changed.  You need to specify \fB--check\fR if you don't want the
363 integrity table to be discarded.
364 .RS
365 .PP
366 @IMAGEX_PROGNAME@ append /dev/sda2 mywim.wim --check "Windows 7"
367 .RE
368 .PP
369
370 .SH SEE ALSO
371 .BR @IMAGEX_PROGNAME@ (1)
372