At work, we send out multiple PCs per day, imaged across a range of models. Within each model, we have a range of HDD sizes.
I was asked to make a networked imaging server, and that’s been relatively easy (I’ll write on that later), using DRBL and Clonezilla.
We have a few issues within our use case, though – Clonezilla can technically handle making an image larger, but *only* proportionally. This is an issue when you’re going from an 80GB image to a 1TB drive – “Why is the recovery partition 80GB?”
Of course, we could just make hundreds of images for every possible drive size, but that’s a lot of room, especially when the difference between drives is purely logical.
Instead, a bit of digging into how Clonezilla stores images and metadata led me to a great discovery. In each image folder, there is a set of metadata files, specifically the geometry specification located in sda-pt.sf.
By modifying this file, we are able to change the drive geometry to our specifications. This was the first step.
After that, it was a simple matter of creating hard links to each non-changing file for that model (the partclone images, specifically). We now have a Ruby script that generates the new image folders, links the files to the base image, and copies over the files that will change between images. After that, it’s a simple matter of generating the geometry (which the script handles in the most common case), and we can have any number of drive size images for the cost of the base image and a few KB per extra image.