Yesterday, while trying to find a solution to a minor distribution problem I came across xdelta. It seems to be an awesome tool – just the way I like it: simple, fast, transparent and commandline based. It can find the difference between two binary files and store that compressed, and then later apply it as a patch. “Why is that neat?”, I hear you cry. Well – simple – now instead of storing a lot of really huge binary files where most of the contents is identical you can just store a source and then the different changes to that. Still don’t get it? Here’s the problem we’re going to solve with it.
Problem: X sales people located all around the world will get an external harddisk with a wmware image featuring all our amazing products for demo purposes. The problem arises whenever new versions of the image is created and needs to be distributed to all the sales people (probably going to happen several times a year). Not all internet connections are just as good for downloading 10gb files. Of course we could split it up, put it on an ftp-server or force everyone to install another of my favorite tools Free Download Manager. However, keeping our audience in mind, an automated solution would probably best.
Potential solution: On all the harddisks we put two images – a working copy they can use for demo’s and a virgin. Whenever we create a new version of the vmware image we’ll use xdelta to make a file containing all binary differences between the virgin image and the latest version – and at the same time compress the differences. We’ll do this using a command-line like this:
xdelta3.0u.x86-32.exe -e -5 -S djw -v -s "virgin-image-file" "newest-image-file" "difference-output-file"
The ‘-5’ indicates medium compression level, ‘-S djw’ is to turn on secondary compression, ‘-v’ is verbose mode – mostly because I’m a geek that likes to see what happens and ‘-s’ indicates the source file.
We can now let the sales people download the difference file together with a small batch-script that’ll apply the differences to their virgin-image and thereby recreating the latest version of the vmware image file using a syntax like this:
xdelta3.0u.x86-32.exe -d -s "virgin-image-file" "difference-file" "newest-image-file"
It tested it and it works. On a 9 GB image, I made some minor changes – like upgraded the EPiServer installed, removed old unused files, etc. That gave me a diff-file of 74 MB – which is a lot easier to download than 9 GB – and applying that file to a virgin image produced a new working image with the latest version installed :-)
Processing time on my laptop was around 800 seconds (< 15 min) for each action.
Enjoy
1 comment:
Based on your blog post we've written a small update app that utilizes xdelta to update VMware instances, all in all a very easy thing to implement. Thanks a lot for this very valuable tip!
Post a Comment