Wim Apply
Wim Apply
NAME
wimapply − Apply a WIM image
SYNOPSIS
wimapply WIMFILE [IMAGE] TARGET [OPTION...]
DESCRIPTION
wimapply, or equivalently wimlib-imagex apply, extracts ("applies") an image, or all images, from the
Windows Imaging (WIM) archive WIMFILE.
IMAGE specifies the image in WIMFILE to extract. It may be the 1-based index of an image, the name of
an image, or the keyword "all" to specify all images. It may be omitted if WIMFILE contains only one im-
age. You can use wiminfo(1) to list the images contained in WIMFILE.
TARGET specifies where to extract the image(s) to. If TARGET is a directory, then the image(s) will be ex-
tracted to that directory as per DIRECTORY EXTRACTION (UNIX) or DIRECTORY EXTRACTION
(WINDOWS). If TARGET does not exist, then a directory will be created there first. Alternatively, if TAR-
GET specifies a UNIX block device, then the image will be extracted to it as described in NTFS VOLUME
EXTRACTION (UNIX).
Note that wimapply is designed to extract, or "apply", full WIM images. If you instead want to extract
only certain files or directories from a WIM image, use wimextract(1) instead.
If IMAGE is "all", then all images in WIMFILE will be extracted into subdirectories of TARGET named af-
ter the images, falling back to the image index when an image has no name or an unusual name. This is not
yet supported in NTFS VOLUME EXTRACTION (UNIX) mode.
If WIMFILE is "-", then the WIM is read from standard input rather than from disk. See PIPABLE WIMS
for more information.
DIRECTORY EXTRACTION (UNIX)
On UNIX-like systems, a WIM image may be extracted to a directory. This mode has the limitation that
NTFS or Windows-specific metadata will not be extracted. Although some concepts such as hard links,
symbolic links, last access timestamps, and last modification timestamps will be translated to their UNIX
equivalents, other metadata will be lost (with warnings given). Notably, the following types of metadata
will not be extracted in this mode:
• Windows file attribute flags
• Windows security descriptors (e.g. file owners and DACLs)
• File creation timestamps
• Reparse points other than symbolic links and junction points
• Named data streams
• Short filenames (also known as 8.3 names or DOS names).
• Object IDs
These same limitations apply to wimextract. As such, this mode is most useful in situations where NTFS
or Windows-specific metadata is unimportant, e.g. when wanting to extract specific files, or when doing file
archiving only on UNIX-like systems, possibly in combination with --unix-data. When Windows-specific
metadata is important, then either the NTFS VOLUME EXTRACTION (UNIX) mode should be used, or
the Windows version of wimlib should be used (see DIRECTORY EXTRACTION (WINDOWS)).
NTFS VOLUME EXTRACTION (UNIX)
On UNIX-like systems, TARGET may also be specified as a block device (e.g. /dev/sda3) containing an un-
mounted NTFS volume. In this mode, wimapply uses libntfs-3g to apply the specified WIM image to the
root directory of the NTFS volume. The target volume should be empty, e.g. newly created by mkntfs(8).
In this mode, NTFS-specific and Windows-specific data and metadata will be extracted, including the fol-
lowing:
• All data streams of all files except encrypted files, including the unnamed data stream as well as all
named data streams.
• Reparse points, including symbolic links, junction points, and other reparse points.
• File and directory creation, access, and modification timestamps, using the native NTFS resolution of
100 nanoseconds.
• Windows security descriptors, including all components (owner, group, DACL, and SACL).
• Windows file attribute flags
• All names of all files, including names in the Win32 namespace, DOS namespace, Win32+DOS name-
space, and POSIX namespace. This includes hard links.
• Object IDs.
However, encrypted files will not be extracted.
Restoring extended attributes (EAs) is also not yet supported in this mode.
Regardless, since almost all information from the WIM image is restored in this mode, it is possible (and
fully supported) to restore an image of an actual Windows installation using wimapply on a UNIX-like sys-
tem as an alternative to using wimapply or DISM on Windows. In the EXAMPLES section below, there is
an example of applying an image from an "install.wim" file as may be found in the Windows installation
media.
Note that to actually boot Windows (Vista or later) from an applied "install.wim" image, you also need to
mark the partition as "bootable" and set up various boot files, such as \BOOTMGR and \BOOT\BCD. The
latter task is most easily accomplished by running bcdboot.exe from a live Windows system such as Win-
dows PE, but there are other options as well.
Finally, note that this mode uses libntfs-3g directly, without going through the ntfs-3g(8) driver. Hence,
there is no special support for applying a WIM image to a directory on which an NTFS filesystem has been
mounted using ntfs-3g(8); you have to unmount it first. There is also no support for applying a WIM image
to some subdirectory of the NTFS volume; you can only apply to the root directory.
DIRECTORY EXTRACTION (WINDOWS)
On Windows, wimapply (and wimextract) natively support NTFS and Windows-specific metadata. For
best results, the target directory should be located on an NTFS volume and the program should be run with
Administrator privileges; however, non-NTFS filesystems and running without Administrator privileges are
also supported, subject to limitations.
On Windows, wimapply tries to extract as much data and metadata as possible, including:
• All data streams of all files. This includes the default file contents, as well as named data streams if
supported by the target volume.
• Reparse points, including symbolic links, junction points, and other reparse points, if supported by the
target volume. Restoring symlinks requires Administrator privileges. Also see --rpfix and --norpfix
for details on how absolute symbolic links and junctions are extracted.
• File and directory creation, access, and modification timestamps, to the highest resolution supported
by the target volume.
• Security descriptors, if supported by the filesystem and --no-acls is not specified. Note that this, in
general, requires Administrator privileges, and may be only partially successful if the program is run
without Administrator privileges (see --strict-acls).
• File attribute flags, including hidden, compressed, encrypted, sparse, etc, when supported by the
filesystem.
• Short filenames (also known as 8.3 names or DOS names).
• Hard links, if supported by the target filesystem.
expected value, unless the --recover-data option is given. (This default behavior seems equivalent to the
/verify option of ImageX.) In addition, a WIM file can include an integrity table (extra checksums) over
the raw data of the entire WIM file. For performance reasons wimlib does not check the integrity table by
default, but the --check option can be passed to make it do so.
ESD files: wimlib can extract files from solid-compressed WIMs, or "ESD" (.esd) files, just like from nor-
mal WIM (.wim) files. However, Microsoft sometimes distributes ESD files with encrypted segments;
wimlib cannot extract such files until they are first decrypted.
Security: wimlib has been carefully written to validate all input and is believed to be secure against some
types of attacks which often plague other file archiving programs, e.g. directory traversal attacks (which, as
it happens, Microsoft’s WIM software is vulnerable to). Important parts of wimlib, e.g. the decompressors,
have also been fuzz tested. However, wimlib is not currently designed to protect against some types of de-
nial-of-service (DOS) attacks, e.g. memory exhaustion or "zip bombs".
EXAMPLES
Extract the first image from the Windows PE WIM on the Windows installation media to the directory
"boot":
wimapply /mnt/windows/sources/boot.wim 1 boot
On Windows, apply an image of an entire volume, for example from "install.wim" which can be found on
the Windows installation media:
wimapply install.wim 1 E:\
Same as above, but running on a UNIX-like system where the corresponding partition is /dev/sda2:
wimapply install.wim 1 /dev/sda2
Note that before running either of the above commands, an NTFS filesystem may need to be created on the
partition, for example with format.exe on Windows or mkntfs(8) on UNIX-like systems. For example, on
UNIX you might run:
mkntfs /dev/sda2 && wimapply install.wim 1 /dev/sda2
(Of course don’t do that if you don’t want to destroy all existing data on the partition!)
See SPLIT WIMS and PIPABLE WIMS for examples of applying split and pipable WIMs, respectively.
SEE ALSO
wimlib-imagex(1) wimcapture(1) wimextract(1) wiminfo(1)