]> wimlib.net Git - wimlib/blob - doc/imagex-apply.1.in
b4b16eaeec7fcbe1508992b3e857797ec071ed0c
[wimlib] / doc / imagex-apply.1.in
1 .TH IMAGEX "1" "September 2012" "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 \fBTARGET\fR specifies where to extract the WIM image(s) to.  If \fBTARGET\fR
20 specifies a directory, the WIM image(s) are extracted to that directory.  If
21 \fBTARGET\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 \fBTARGET\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 .SH NORMAL MODE
27
28 The normal extraction mode is entered when \fBTARGET\fR is a directory or
29 non-existent file.  If a single WIM image is being extracted, it will be
30 extracted with the root of the image corresponding to the directory named by
31 \fBTARGET\fR; or, if the keyword \fBall\fR is given, the images are extracted
32 into subdirectories of \fITARGET\fR that will be named after the image names,
33 falling back to the image indices if there is an image with no name.
34 \fITARGET\fR can specify a directory on any type of filesystem.
35
36 In the normal mode of extraction, the following information will be extracted
37 from the WIM image(s):
38
39 .IP \[bu] 4
40 The default (unnamed) data stream of each file
41 .IP \[bu]
42 Hard links, if supported by the underlying filesystem
43 .IP \[bu]
44 File and directory creation, access, and modification timestamps to the nearest
45 microsecond, if supported by the underlying filesystem
46 .IP \[bu]
47 Symbolic links and junction points, although they will not necessarily point to
48 the desired location (for example, the target of the link may contain a Windows
49 drive letter).
50
51 .PP
52 In the normal mode of extraction, the following information will \fInot\fR be
53 extracted from the WIM image(s):
54
55 .IP \[bu] 4
56 Security descriptors (file permissions)
57 .IP \[bu]
58 The alternate (named) data streams for each file
59 .IP \[bu]
60 Reparse points other than symbolic links and junction points
61 .IP \[bu]
62 Certain file attributes such as compression, encryption, and sparseness.
63 .IP \[bu]
64 Short (DOS) names for files
65
66 .SH NTFS MODE
67
68 A special extraction mode is entered when \fBTARGET\fR is a regular file or
69 block device.  \fBTARGET\fR is interpreted as an NTFS volume and opened using
70 libntfs-3g.  If successful, the WIM image is extracted to the root of the NTFS
71 volume in a special mode that preserves all, or almost all, information
72 contained in the WIM.  \fBIMAGE\fR may not be "all" for this action.
73
74 The NTFS volume does not need to be empty, although it's expected that it be
75 empty for the intended use cases.  A new NTFS filesystem can be created using
76 the \fBmkntfs\fR (8) command.
77
78 The NTFS extraction mode is not available if wimlib was compiled using the
79 --without-ntfs-3g option.
80
81 Please note that the NTFS extraction mode is \fInot\fR entered if \fITARGET\fR
82 is a directory, even if a NTFS filesystem is mounted on \fITARGET\fR.  You must
83 specify the NTFS volume itself (and it must be unmounted, and you must have
84 permission to write to it).
85
86 In the NTFS extraction mode, the following information will be extracted from
87 the WIM image:
88
89 .IP \[bu] 4
90 The data streams of all files, including the un-named data stream as well as all
91 named data streams.
92 .IP \[bu]
93 Reparse points, including symbolic links, junction points, and other reparse
94 points.
95 .IP \[bu]
96 Hard links.
97 .IP \[bu]
98 File and directory creation, access, and modification timestamps are set to the
99 100-nanosecond resolution values specified in the WIM file.
100 .IP \[bu] 4
101 The security descriptor for each file is applied if there is one specified in
102 the WIM.
103 .IP \[bu]
104 File attribute flags are applied.
105 .IP \[bu]
106 Short (DOS) names for files are extracted.  The corresponding long name for each
107 DOS name is made to be a Win32 name.  Any additional names for the file in the
108 same directory are made to be names in the POSIX namespace.
109
110 .PP
111
112 In the NTFS extraction mode, we restore enough information from the WIM that it
113 is possible, in most cases, to restore or install an image of an actual Windows
114 installation. In the examples at the end of this manual page, we show an example
115 of applying an image from the "install.wim" file contained in the installation
116 media for Windows Vista, Windows 7, and Windows 8 in the "sources" directory.
117
118 In order to actually boot Windows from an applied image, you must understand the
119 boot process of Windows versions Vista and later.  Basically, it is the
120 following:
121
122 .nr step 1 1
123 .IP \n[step]. 3
124 The Master Boot Record loads the Volume Boot Record (also called the Boot
125 Sector) of the active partition, which is on an NTFS filesystem.  This partition
126 is called the "system partition".
127 .IP \n+[step].
128 The "bootmgr" program on the "system partition" is loaded (\\BOOTMGR).
129 .IP \n+[step].
130 bootmgr loads the Boot Configuration Data (\\Boot\\BCD) from the "system
131 partition".
132 .IP \n+[step].
133 Based on the information contained in the Boot Configuration Data, a loader for
134 the Windows kernel is executed from the "Boot" partition, which is where Windows
135 is installed.
136
137 .PP
138
139 So let's say you applied an image from an existing "install.wim" as in the
140 example, or you've applied a custom Windows image that you've created using the
141 \fBimagex capture\fR (1) command.  You've just applied the "Boot" partition, or
142 the main Windows partition, but there is no "System" partition yet (i.e.  no
143 \\BOOTMGR and no \\Boot\\BCD).
144
145 A "System" partition can be created created by running the "bcdboot.exe" program
146 from within Windows or Windows PE.  Alternatively, you can capture a separate
147 WIM image containing the "System" partition.  Or, the "System" partition may the
148 same as the "Boot" partition, so the two "partitions" may be combined in one WIM
149 image.  However, as the \\Boot\\BCD file contains the Windows bootloader
150 configuration, a WIM containing it can only be used on systems where you are
151 setting up the same bootloader configuration, including the same partition
152 layout.
153
154 Besides setting up the files on the "System" partition, don't forget to set the
155 bootable flag on it, and have a master boot record that loads the bootable
156 partition (Windows' MBR does, and SYSLINUX provides an equivalent MBR).
157
158 .SH OPTIONS
159 .TP 6
160 \fB--check\fR
161 When reading \fIWIMFILE\fR, verify its integrity if the integrity table is
162 present.
163 .TP
164 \fB--hardlink\fR
165 When extracting a file from the WIM that is identical to a file that has already
166 extracted, create a hard link using \fBlink\fR (3) rather than creating a
167 separate file.  This option causes all identical files to be hard-linked,
168 overriding the hard link groups that are specified in the WIM image(s).  In the
169 case of extracting all images from the WIM, files may be hard-linked even if
170 they are in different WIM images.  This option is not available in the NTFS
171 extraction mode.
172 .TP
173 \fB--symlink\fR
174 This option is similar to \fB--hardlink\fR, except symbolic links are created
175 instead.  This option is not available in the NTFS extraction mode.
176 .TP
177 \fB--verbose\fR
178 Print the path to of each file or directory within the WIM image as it is
179 extracted, and some additional informational messages.
180
181 .SH NOTES
182
183 \fBimagex apply\fR does not yet support split WIMs.
184
185 \fBimagex apply\fR calculates the SHA1 message digest of every file stream it
186 extracts and verifies that it is the same as the SHA1 message digest provided in
187 the WIM file.  It is an error if the message digests don't match.  It's also
188 considered to be an error if any WIM resources cannot be found in the stream
189 lookup table.  So you can be sure that the files are extracted correctly, even
190 though we don't provide a \fB/verify\fR option like Microsoft's version of
191 imagex does.  Please note that this is separate from the integrity table of the
192 WIM, which provides SHA1 message digests over raw chunks of the entire WIM file
193 and is checked separately if the \fB--check\fR option is specified.
194
195 .SH EXAMPLES
196 .SS Normal extraction mode
197 Extract the first image from the Windows PE image from the Windows Vista/7/8
198 installation media to the directory "boot":
199 .RS
200 .PP
201 image apply /media/windows/sources/boot.wim 1 boot
202 .RE
203 .PP
204 Extract all images from the Windows PE image from the Windows Vista/7/8
205 installation media to the directory "boot", and hard link all identical files:
206 .RS
207 .PP
208 image apply /media/windows8/sources/boot.wim all boot --hardlink
209 .RE
210 .PP
211 .SS NTFS extraction mode
212 Verbosely apply a WIM image to a NTFS filesystem image:
213 .RS
214 .PP
215 imagex apply mywim.wim 1 fsimage.ntfs --verbose
216 .RE
217 .PP
218 Create a new NTFS filesystem on the partition /dev/sda2 and apply the first
219 image in the Windows Vista/7/8 installation WIM to it.  (Obviously, only do this
220 if you want to erase everything on that partition.)
221 .RS
222 .PP
223 mkntfs /dev/sda2 && imagex apply /media/windows/sources/install.wim 1 /dev/sda2
224 .RE
225 .PP
226
227 .SH SEE ALSO
228 .BR imagex (1)
229