]> wimlib.net Git - wimlib/blob - doc/imagex-apply.1.in
wimlib.h: Update wimlib_add_image() docs
[wimlib] / doc / imagex-apply.1.in
1 .TH IMAGEX "1" "April 2013" "@IMAGEX_PROGNAME@ @VERSION@" "User Commands"
2 .SH NAME
3 @IMAGEX_PROGNAME@-apply \- Extract one image, or all images, from a WIM archive
4
5 .SH SYNOPSIS
6 \fB@IMAGEX_PROGNAME@ apply\fR \fIWIMFILE\fR \fIIMAGE\fR \fITARGET\fR [\fIOPTION\fR]...
7
8 .SH DESCRIPTION
9 .PP
10
11 \fB@IMAGEX_PROGNAME@ apply\fR extracts an image, or all images, from the Windows Imaging
12 (WIM) file \fIWIMFILE\fR.
13
14 Note: this man page primarily documents the UNIX behavior.  See \fBWINDOWS
15 VERSION\fR for information specific to the Windows build of wimlib.
16
17 \fIIMAGE\fR specifies the WIM image to extract.  It may be a 1-based index of an
18 image in the WIM, the name of an image in the WIM, or the keyword "all" to
19 indicate that all images are to be extracted.  Use the \fB@IMAGEX_PROGNAME@ info\fR (1)
20 command to show what images a WIM file contains.
21
22 \fITARGET\fR specifies where to extract the WIM image(s) to.  If \fITARGET\fR
23 specifies a directory, the WIM image(s) are extracted to that directory.  If
24 \fITARGET\fR specifies a non-existent file, a directory is created in that
25 location and the WIM image(s) are extracted to that directory.  If \fITARGET\fR
26 specifies a regular file or block device, it is interpreted as a NTFS volume to
27 which the WIM image is to be extracted.
28
29 \fB@IMAGEX_PROGNAME@ apply\fR supports applying images from stand-alone WIMs as well as
30 split WIMs.  See \fBSPLIT WIMS\fR.
31
32 .SH NORMAL MODE
33
34 The normal extraction mode is entered when \fITARGET\fR is a directory or
35 non-existent file.  If a single WIM image is being extracted, it is extracted
36 with the root directory of the image corresponding to the directory named by
37 \fITARGET\fR; or, if the keyword \fBall\fR is given, the images are extracted
38 into subdirectories of \fITARGET\fR that are be named after the image names,
39 falling back to the image index for an image with no name.  \fITARGET\fR can
40 specify a directory on any type of filesystem.
41
42 In the normal mode of extraction, the following information is extracted from
43 the WIM image(s):
44
45 .IP \[bu] 4
46 The default (unnamed) data stream of each file
47 .IP \[bu]
48 Hard links
49 .IP \[bu]
50 File and directory creation, access, and modification timestamps to the nearest
51 100 nanoseconds, if supported by the underlying filesystem, operating system,
52 and C library
53 .IP \[bu]
54 Symbolic links and junction points, although they will not necessarily point to
55 the desired location (for example, the target of the link may contain a Windows
56 drive letter).
57
58 .PP
59 In the normal mode of extraction, the following information will \fInot\fR be
60 extracted from the WIM image(s):
61
62 .IP \[bu] 4
63 Security descriptors (file permissions) except through the extensions available
64 through the \fB--unix-data\fR option
65 .IP \[bu]
66 The alternate (named) data streams for each file
67 .IP \[bu]
68 Reparse points other than symbolic links and junction points
69 .IP \[bu]
70 Certain file attributes such as compression, encryption, and sparseness.
71 .IP \[bu]
72 Short (DOS) names for files
73
74 .SH NTFS MODE
75
76 A special extraction mode is entered when \fITARGET\fR is a regular file or
77 block device.  If this is the case, \fITARGET\fR is interpreted as an NTFS
78 volume and opened using libntfs-3g.  If successful, the WIM image is extracted
79 to the root of the NTFS volume in a special mode that preserves all information
80 contained in the WIM image.  \fIIMAGE\fR may not be "all" for this action.
81
82 The NTFS volume does not need to be empty, although it's expected that it be
83 empty for the intended use cases.  A new NTFS filesystem can be created using
84 the \fBmkntfs\fR (8) command.
85
86 The NTFS extraction mode is not available if wimlib was compiled using the
87 \fB--without-ntfs-3g\fR option.
88
89 Please note that the NTFS extraction mode is \fInot\fR entered if \fITARGET\fR
90 is a directory, even if a NTFS filesystem is mounted on \fITARGET\fR.  You must
91 specify the NTFS volume itself (and it must be unmounted, and you must have
92 permission to write to it).
93
94 In the NTFS extraction mode, the following information will be extracted from
95 the WIM image:
96
97 .IP \[bu] 4
98 The data streams of all files, including the un-named data stream as well as all
99 named data streams.
100 .IP \[bu]
101 Reparse points, including symbolic links, junction points, and other reparse
102 points.
103 .IP \[bu]
104 Hard links.
105 .IP \[bu]
106 File and directory creation, access, and modification timestamps are set to the
107 100-nanosecond resolution values specified in the WIM file.
108 .IP \[bu] 4
109 The security descriptor for each file is applied if there is one specified in
110 the WIM.
111 .IP \[bu]
112 File attribute flags are applied.
113 .IP \[bu]
114 Short (DOS) names for files are extracted.  The corresponding long name for each
115 DOS name is made to be a Win32 name.  Any additional names for the file in the
116 same directory are made to be names in the POSIX namespace.
117
118 .PP
119
120 Since all information from the WIM image is restored in the NTFS extraction
121 mode, it is possible to restore an image of an actual Windows installation. In
122 the examples at the end of this manual page, there is an example of applying an
123 image from the "install.wim" file contained in the installation media for
124 Windows Vista, Windows 7, and Windows 8 in the "sources" directory.
125
126 But in order to actually boot Windows from an applied image, you must understand
127 the boot process of Windows versions Vista and later.  Basically, it is the
128 following:
129
130 .nr step 1 1
131 .IP \n[step]. 3
132 The Master Boot Record loads the Volume Boot Record (also called the Boot
133 Sector) of the active partition, which is on an NTFS filesystem.  This partition
134 is called the "system partition".
135 .IP \n+[step].
136 The "bootmgr" program on the "system partition" is loaded (\\BOOTMGR).
137 .IP \n+[step].
138 bootmgr loads the Boot Configuration Data (\\Boot\\BCD) from the "system
139 partition".
140 .IP \n+[step].
141 Based on the information contained in the Boot Configuration Data, a loader for
142 the Windows kernel is executed from the "Boot" partition, which is where Windows
143 is installed.
144
145 .PP
146
147 So let's say you applied an image from an existing "install.wim" as in the
148 example, or you've applied a custom Windows image that you've created using the
149 \fB@IMAGEX_PROGNAME@ capture\fR (1) command.  You've just applied the "Boot" partition, or
150 the main Windows partition, but there is no "System" partition yet (i.e.  no
151 \\BOOTMGR and no \\Boot\\BCD).
152
153 A "System" partition can be created created by running the "bcdboot.exe" program
154 from within Windows or Windows PE.  Alternatively, you can capture a separate
155 WIM image containing the "System" partition.  Or, the "System" partition may the
156 same as the "Boot" partition, so the two "partitions" may be combined in one WIM
157 image.  However, as the \\Boot\\BCD file contains the Windows bootloader
158 configuration, a WIM containing it can only be used on systems where you are
159 setting up the same bootloader configuration, including the same partition
160 layout.
161
162 Besides setting up the files on the "System" partition, don't forget to set the
163 bootable flag on it, and have a master boot record that loads the bootable
164 partition (Windows' MBR does, and SYSLINUX provides an equivalent MBR).
165
166 .SH SPLIT WIMS
167
168 You may use \fB@IMAGEX_PROGNAME@ apply\fR to apply images from a split WIM.  The
169 \fIWIMFILE\fR argument is used to specify the first part of the split WIM, and
170 the \fB--refs\fR="\fIGLOB\fR" option is used to provide a shell-style file glob
171 that specifies the additional parts of the split WIM.  \fIGLOB\fR is expected to
172 be a single string on the command line, so \fIGLOB\fR must be quoted so that it
173 is protected against shell expansion.  \fIGLOB\fR must expand to all parts of
174 the split WIM, except optionally the first part which may either omitted or
175 included in the glob (but the first part MUST be specified as \fIWIMFILE\fR as
176 well).
177
178 Here's an example.  The names for the split WIMs usually go something like:
179
180 .RS
181 .PP
182 .nf
183 mywim.swm
184 mywim2.swm
185 mywim3.swm
186 mywim4.swm
187 mywim5.swm
188 .RE
189
190 To apply the first image of this split WIM to the directory "dir", run:
191 .PP
192 .RS
193 @IMAGEX_PROGNAME@ apply mywim.swm 1 dir --ref="mywim*.swm"
194 .RE
195 .PP
196
197 .SH WINDOWS VERSION
198
199 This section documents the differences between \fB@IMAGEX_PROGNAME@ apply\fR in the Windows
200 builds of wimlib versus the rest of this man page, which is written to document
201 the UNIX build.
202
203 \fB@IMAGEX_PROGNAME@ apply\fR does not have separate "normal" and "NTFS" modes on Windows.
204 There is simply one mode, and it uses the Windows API to apply NTFS-specific
205 information, including alternate data streams, reparse points, hard links, and
206 file attributes.  So, you essentially get the advantages of the "NTFS mode"
207 documented above, but you can apply the WIM image to any directory, not just an
208 entire NTFS volume.  This is essentially the same behavior as Microsoft's
209 ImageX.
210
211 \fB--hardlink\fR, \fB--symlink\fR, and \fB--unix-data\fR are not supported on
212 Windows.
213
214 Except for the differences documented in this section, the Windows build of
215 \fB@IMAGEX_PROGNAME@ apply\fR should be essentially equivalent to the UNIX build.  However,
216 one additional thing to note is that wimlib's Windows ImageX is NOT written to
217 be command-line compatible with Microsoft's ImageX, although they are very
218 similar.
219
220 .SH OPTIONS
221 .TP 6
222 \fB--check\fR
223 When reading \fIWIMFILE\fR, verify its integrity if the integrity table is
224 present.
225 .TP
226 \fB--hardlink\fR
227 When extracting a file from the WIM that is identical to a file that has already
228 extracted, create a hard link rather than creating a separate file.  This option
229 causes all identical files to be hard-linked, overriding the hard link groups
230 that are specified in the WIM image(s).  In the case of extracting all images
231 from the WIM, files may be hard-linked even if they are in different WIM images.
232 This option is not available in the NTFS extraction mode.
233 .TP
234 \fB--symlink\fR
235 This option is similar to \fB--hardlink\fR, except symbolic links are created
236 instead.  This option is not available in the NTFS extraction mode.
237 .TP
238 \fB--verbose\fR
239 Print the path to of each file or directory within the WIM image as it is
240 extracted, and some additional informational messages.
241 .TP
242 \fB--ref\fR="\fIGLOB\fR"
243 File glob of additional split WIM parts that are part of the split WIM being
244 applied.  See \fBSPLIT_WIMS\fR.
245 .TP
246 \fB--unix-data\fR
247 This option may only be given in the normal extraction mode (not NTFS).  By
248 default, in the normal extraction mode on UNIX, \fB@IMAGEX_PROGNAME@ apply\fR
249 will ignore both Windows-style security descriptors and UNIX-specific file
250 owners, groups, and modes set when using \fB@IMAGEX_PROGNAME@ capture\fR with
251 the \fB--unix-data\fR flag.  By passing \fB--unix-data\fR to
252 \fB@IMAGEX_PROGNAME@ apply\fR instead, this causes this UNIX-specific data to be
253 restored when available.
254 .TP
255 \fB--no-acls\fR
256 In the NTFS apply mode, do not apply security descriptors.  This flag is also
257 available in the native Win32 build of wimlib and may be useful when running
258 \fB@IMAGEX_PROGNAME@\fR as a non-administrator.
259 .TP
260 \fB--strict-acls\fR
261 Fail immediately if the full security descriptor of any file or directory cannot
262 be set exactly as specified in the WIM file.  The default behavior without this
263 option is to fall back to setting a security descriptor with the SACL omitted,
264 then only the default inherited security descriptor, if we do not have
265 permission to set the desired one.
266 .TP
267 \fB--rpfix\fR, \fB--norpfix\fR
268 Set whether to fix targets of absolute symbolic links (reparse points in Windows
269 terminology) or not.  When enabled (\fB--rpfix\fR), extracted absolute symbolic
270 links that are marked in the WIM image as being fixed are assumed to have
271 absolute targets relative to the image root, and therefore have the actual root
272 of extraction prepended to their targets.  The intention is that you can apply
273 an image containing absolute symbolic links and still have them be valid after
274 it's been applied to any location.
275
276 The default behavior is \fB--rpfix\fR if any images in \fIWIMFILE\fR have been
277 captured with reparse-point fixups done.  Otherwise, it is \fB--norpfix\fR.
278
279 .SH NOTES
280
281 \fB@IMAGEX_PROGNAME@ apply\fR calculates the SHA1 message digest of every file stream it
282 extracts and verifies that it is the same as the SHA1 message digest provided in
283 the WIM file.  It is an error if the message digests don't match.  It's also
284 considered to be an error if any WIM resources cannot be found in the stream
285 lookup table.  So you can be fairly certain that the file streams are extracted
286 correctly, even though \fB@IMAGEX_PROGNAME@ apply\fR don't have a \fB/verify\fR option like
287 Microsoft's ImageX does.  Please note that this is separate from the integrity
288 table of the WIM, which provides SHA1 message digests over raw chunks of the
289 entire WIM file and is checked separately if the \fB--check\fR option is
290 specified.
291
292 You cannot use \fB@IMAGEX_PROGNAME@ apply\fR to apply a WIM from a pipe (such as standard
293 input) because the WIM file format is not designed for this.
294
295 .SH EXAMPLES
296 .SS Normal extraction mode
297 Extract the first image from the Windows PE image from the Windows Vista/7/8
298 installation media to the directory "boot":
299 .RS
300 .PP
301 @IMAGEX_PROGNAME@ apply /media/windows/sources/boot.wim 1 boot
302 .RE
303 .PP
304 Extract all images from the Windows PE image from the Windows Vista/7/8
305 installation media to the directory "boot", and hard link all identical files:
306 .RS
307 .PP
308 @IMAGEX_PROGNAME@ apply /media/windows8/sources/boot.wim all boot --hardlink
309 .RE
310 .PP
311 .SS NTFS extraction mode
312 Apply a WIM image to a NTFS filesystem image:
313 .RS
314 .PP
315 @IMAGEX_PROGNAME@ apply mywim.wim 1 fsimage.ntfs
316 .RE
317 .PP
318 Create a new NTFS filesystem on the partition /dev/sda2 and apply the first
319 image in the Windows Vista/7/8 installation WIM to it.  (Obviously, only do this
320 if you want to erase everything on that partition.)
321 .RS
322 .PP
323 mkntfs /dev/sda2 && @IMAGEX_PROGNAME@ apply /media/windows/sources/install.wim 1 /dev/sda2
324 .RE
325 .PP
326
327 .SH SEE ALSO
328 .BR @IMAGEX_PROGNAME@ (1)
329