wimlib-imagex-optimize(1) Optimize a WIM archive

SYNOPSIS

wimlib-imagex optimize WIMFILE [OPTION...]

DESCRIPTION

wimlib-imagex optimize will rebuild the stand-alone WIM WIMFILE. The new WIM is written to a temporary file, and it is renamed to the original file when it's ready. This action will remove any holes that have been left as a result of appending images, so the new WIM may be slightly smaller than the old WIM.

By default, compressed data will be re-used, and not recompressed. Use the --recompress or --compress=TYPE[:LEVEL] option to request recompression.

This command is also available as simply wimoptimize if the appropriate hard link or batch file has been installed.

OPTIONS

--check
When reading WIMFILE, verify its integrity if an integrity table is present. In addition, include an integrity table in the optimized WIM. If this option is not specified, by default the integrity table (if present) is not checked, and an integrity table is included in the rebuilt WIM if and only if one was present in the original WIM.
--nocheck
Neither verify the integrity of WIMFILE using the integrity table, nor include an integrity table in the rebuilt WIM file.
--recompress
Recompress all compressed streams in WIMFILE when rebuilding it. This will greatly increase the time needed to rebuild the WIM file, but it may result in a better compression ratio if wimlib can do a better job than the program that wrote the original file.
--compress=TYPE[:LEVEL]
Recompress the WIM file using the specified compression type, and optionally the specified compression level for that compression type. This implies --recompress.
See the documentation for this option to wimlib-imagex capture (1) for more details.
--chunk-size=SIZE
Set the WIM compression chunk size to SIZE. See the documentation for this option to wimlib-imagex capture (1) for more details.
--solid
Create a "solid" archive that compresses multiple files together. This can result in a higher compression ratio, but has disadvantages such as reduced compatibility. See the documentation for this option to wimlib-imagex capture (1) for more details.
--solid-chunk-size=SIZE
Like --chunk-size, but set the chunk size used in solid resources. See the documentation for this option to wimlib-imagex capture (1) for more details.
--solid-compress=TYPE[:LEVEL]
Like --compress, but set the compression type used in solid resources. See the documentation for this option to wimlib-imagex capture (1) for more details.
--threads=NUM_THREADS
Number of threads to use for compressing data. Default: autodetect (number of processors). This parameter only has an effect when data recompression is requested.
--pipable
Rebuild the WIM so that it can be applied fully sequentially, including from a pipe. See wimlib-imagex capture(1) for more details about creating pipable WIMs. By default, when neither --pipable or --not-pipable is specified, the rebuilt WIM will be pipable if and only if it was already pipable.
--not-pipable
Rebuild the WIM in the non-pipable format. (This is the default if WIMFILE is not pipable.)
--unsafe-compact
Compact the WIM file in-place, without using a temporary file. Existing resources are shifted down to fill holes and new resources are appended as needed. The WIM file is truncated to its final size, which may shrink the on-disk file. THIS OPERATION CANNOT BE SAFELY INTERRUPTED! If the operation is interrupted, then the WIM file will be corrupted, and it may be impossible (or at least very difficult) to recover any data from it. Users of this option are expected to know what they are doing and assume responsibility for any data corruption that may result.

NOTES

wimlib-imagex optimize does not support split WIMs.

wimlib-imagex optimize is roughly equivalent to:

wimlib-imagex export WIMFILE all tmp.wim && mv tmp.wim WIMFILE

EXAMPLES

Rebuild the WIM file 'install.wim':

wimoptimize install.wim

Rebuild and recompress the WIM file 'install.wim':

wimoptimize install.wim --recompress

Rebuild and recompress the WIM file 'install.wim', using LZX ("maximum") compression at a higher-than-default compression level. The compression chunk size remains unchanged. This command will be slow, but it might be useful for optimizing files for distribution. See https://wimlib.net/compression.html for some benchmark results.

wimoptimize install.wim --compress=LZX:100