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