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.
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
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
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
If all worked fine, the following files should be present:
- 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
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:
Happy imaging !