ImageX is a command-line tool for capturing, modifying and applying file based disk images. ImageX is included within the Windows Automated Installation Kit.
In this post I want to focus on the functionality provided by ImageX to split and merge image files. So why would you want to split and merge image files? Well think of the following scenarios:
- Your image is too big to fit on one DVD and using Dual Layer DVD media is not an option.
- Network related limitations to transfer large files
- Merge image files provided on multiple DVDs for network based deployment
For the purpose of writing this article, I prepared a simple folder structure to demonstrate the capture, split and merge process.
To run the following commands you must open the “Deployment Tools command prompt” which gets automatically added to your start menu when having installed the WAIK. Note that all commands must be run with Administrator privileges.
Image Capture
Use the following command to capture the first image:
imagex /capture c:\data\splitmerge\source c:\data\splitmerge\output1\splitmerge.wim "splitmerge" /COMPRESS maximum
For validation purposes, I talk about that later, we also produce an image info file using the following command:
imagex /info /xml c:\data\splitmerge\output1\splitmerge.wim > info1.xml
Image Split
Now we are going to split the previously created splitmerge.wim file. Since we are dealing with a rather small image file, the split is set at 20 MB.
imagex /split c:\data\splitmerge\output1\splitmerge.wim c:\data\splitmerge\output2\splitmerge.swm 20
and again we create an image info file.
imagex /info /xml c:\data\splitmerge\output2\splitmerge.swm > info2.xml
Image Merge
Finally we are going to merge the previously splitted image file back into a single image file.
imagex /ref c:\data\splitmerge\output2\splitmerge*.swm /check /export c:\data\splitmerge\output2\splitmerge.swm 1 c:\data\splitmerge\output3\splitmerge.wim "splitmerge" /COMPRESS maximum
and create the image info file
imagex /info /xml c:\data\splitmerge\output3\splitmerge.wim > info3.xml
The Output
If all worked fine, the following files should be present:
- C:\DATA\splitmerge\output1\splitmerge.wim
- C:\DATA\splitmerge\output2\splitmerge.swm, splitmerge2.swm and depending on the size of the source folder your might also get an additional splitmerge3.swm
- C:\DATA\splitmerge\output3\splitmerge.wim
- C:\DATA\splitmerge\info1.xml
- C:\DATA\splitmerge\info2.xml
- C:\DATA\splitmerge\info3.xml
Checking data integrity
When comparing the file size of the splitmerge.wim stored in c:\data\splitmerge\output1 with splitmerge.wim stored in c:\data\splitmerge\output3 you will probably notice that the size in bytes differs. The same applies for the total size of the swm files stored in c:\data\splitmerge\output2.
Well, forget about these file/folder sizes, to ensure that your final wim file contains the exact same data as the initial wim file, we’ll take a look at the previously created image info files.
All of the 3 image info files have the same value stored for:
<FILECOUNT>43</FILECOUNT>
<TOTALBYTES>41339064</TOTALBYTES>
Happy imaging !
Related articles:
Thanks Alex,
it helped me alot.
The process starts, but then I get an “access denied”. I’m running from DOS command line in Admin level.
As a follow up to my previous reply, removing the /compress parameter fixed the “access denied” problem.
Thank you.
Thanks for the useful and concise information.
@John – The split and join worked for me. I ran it under Windows PE.
Hi Guys,
E:\AIO\install.swm
E:\AIO\install2.swm
This is the path of my 2 swm files, could you please help me with the exact command i should type to combine all of them to one WIM file (? I’m weak in dos, 🙂
I currently can see “C:\Program Files\Windows AIK\Tools\PETools>” in the command prompt.
Is it me, or am I the only one that sees the error on this page which I list here.
◾The folder “Output2” is used to store the merged image file created from the splitted image files that are stored in folder “Output2”.
should be the folder “Output3” is used to store the merged image file…that are stored in folder “Output2”