]> wimlib.net Git - wimlib/blob - doc/man1/wimoptimize.1
v1.13.0
[wimlib] / doc / man1 / wimoptimize.1
1 .TH WIMOPTIMIZE "1" "November 2018" "wimlib 1.13.0" "User Commands"
2 .SH NAME
3 wimoptimize \- Optimize a WIM archive
4 .SH SYNOPSIS
5 \fBwimoptimize\fR \fIWIMFILE\fR [\fIOPTION\fR...]
6 .SH DESCRIPTION
7 \fBwimoptimize\fR, or equivalently \fBwimlib-imagex optimize\fR, rebuilds the
8 standalone WIM archive \fIWIMFILE\fR.  The new WIM is written to a temporary
9 file, and it is renamed to the original file when it's ready.  This will remove
10 any holes that have been left in the WIM as a result of appending or deleting
11 files or images, so the new WIM may be smaller than the old WIM.
12 .PP
13 By default, \fBwimoptimize\fR will reuse (not recompress) compressed data and
14 will not change the solid or pipable status of the WIM.  However, it can also
15 perform recompression and/or convert between solid, non-solid, pipable, and
16 non-pipable WIMs; see the options and examples below.
17 .SH OPTIONS
18 .TP 6
19 \fB--check\fR
20 Before optimizing the WIM, verify its integrity if it contains extra integrity
21 information.  Also include extra integrity information in the optimized WIM,
22 even if it was not present before.
23 .TP
24 \fB--nocheck\fR
25 Do not include extra integrity information in the optimized WIM, even if it was
26 present before.
27 .TP
28 \fB--include-integrity\fR
29 Include extra integrity information in the optimized WIM, i.e. like
30 \fB--check\fR but don't also verify the WIM beforehand.
31 .TP
32 \fB--recompress\fR
33 Recompress all data in the WIM while optimizing it.  This will significantly
34 increase the time needed to optimize the WIM, but it may result in a better
35 compression ratio if wimlib can do a better job than the program that created
36 the WIM --- which is likely the case if the WIM was Microsoft-created, as
37 wimlib's compressors are slightly stronger.
38 .TP
39 \fB--compress\fR=\fITYPE\fR[:\fILEVEL\fR]
40 Recompress the WIM using the specified compression type, and optionally the
41 specified compression level for that compression type.  This implies
42 \fB--recompress\fR.  See the documentation for this option to
43 \fBwimcapture\fR(1) for more details.
44 .TP
45 \fB--chunk-size\fR=\fISIZE\fR
46 Set the WIM compression chunk size to \fISIZE\fR.  See the documentation for
47 this option to \fBwimcapture\fR(1) for more details.
48 .TP
49 \fB--solid\fR
50 Create a "solid" archive that compresses multiple files together.  This usually
51 results in a significantly better compression ratio but has disadvantages such
52 as reduced compatibility.  See the documentation for this option to
53 \fBwimcapture\fR(1) for more details.
54 .TP
55 \fB--solid-compress\fR=\fITYPE\fR[:\fILEVEL\fR]
56 Like \fB--compress\fR, but set the compression type used in solid resources.
57 See the documentation for this option to \fBwimcapture\fR(1) for more details.
58 .TP
59 \fB--solid-chunk-size\fR=\fISIZE\fR
60 Like \fB--chunk-size\fR, but set the chunk size used in solid resources.  See
61 the documentation for this option to \fBwimcapture\fR(1) for more details.
62 .TP
63 \fB--threads\fR=\fINUM_THREADS\fR
64 Number of threads to use for compressing data.  Default: autodetect (number of
65 processors).
66 .TP
67 \fB--pipable\fR
68 Rebuild the WIM so that it can be applied fully sequentially, including from a
69 pipe.  See \fBwimcapture\fR(1) for more details about creating pipable WIMs.  By
70 default, when neither \fB--pipable\fR or \fB--not-pipable\fR is specified, the
71 optimized WIM will be pipable if and only if it was pipable before.
72 .TP
73 \fB--not-pipable\fR
74 Rebuild the WIM in the non-pipable format.
75 .TP
76 \fB--unsafe-compact\fR
77 Compact the WIM in-place, without using a temporary file.  Existing resources
78 are shifted down to fill holes and new resources are appended as needed.  The
79 WIM is truncated to its final size, which may shrink the on-disk file.  This is
80 more efficient than a full rebuild, but it is only supported when no
81 recompression is being done.  More importantly, AN UNSAFE COMPACTION OPERATION
82 CANNOT BE SAFELY INTERRUPTED!  If the operation is interrupted, then the WIM
83 will be corrupted, and it may be impossible (or at least very difficult) to
84 recover any data from it.  Users of this option are expected to know what they
85 are doing and assume responsibility for any data corruption that may result.
86 .SH NOTES
87 \fBwimoptimize\fR does not support split WIMs or delta WIMs.  For such files,
88 consider using \fBwimexport\fR(1) instead.  Note that \fBwimoptimize\fR is
89 roughly equivalent to:
90 .RS
91 .PP
92 \fBwimexport\fR \fIWIMFILE\fR all tmp.wim && mv tmp.wim \fIWIMFILE\fR
93 .RE
94 .PP
95 .SH EXAMPLES
96 Rebuild 'install.wim':
97 .RS
98 .PP
99 wimoptimize install.wim
100 .RE
101 .PP
102 Rebuild and recompress 'install.wim':
103 .RS
104 .PP
105 wimoptimize install.wim --recompress
106 .RE
107 .PP
108 Rebuild and recompress 'install.wim' using LZX ("maximum") compression at a
109 higher-than-default compression level.  The compression chunk size remains
110 unchanged.  This command will be slow, but it might be useful for optimizing
111 files for distribution.  See \fIhttps://wimlib.net/compression.html\fR for some
112 benchmark results.
113 .RS
114 .PP
115 wimoptimize install.wim --compress=LZX:100
116 .RE
117 .PP
118 Recompress 'install.wim' using solid-mode compression, then rename it to
119 \'install.esd\'.  This will decrease the archive size significantly.  (Also
120 consider using 'wimexport install.wim all install.esd --solid'.):
121 .RS
122 .PP
123 wimoptimize install.wim --solid
124 .br
125 mv install.wim install.esd
126 .RE
127 .SH SEE ALSO
128 .BR wimlib-imagex (1)
129 .BR wimexport (1)
130 .BR wimverify (1)