Needed to shrink a full directory of QEMU QCOW2 images today that had grown over time with snapshots and general use. While there is information around on the web about it, the focus is on single images and the code provided are just examples.
Here’s a script to keep around that shrinks and compresses all images in a folder, and shows progress:
#!/bin/bash
for imageFile in *.qcow2
do
echo "Processing $imageFile"
mv "$imageFile" "$imageFile.orig"
qemu-img convert -p -c -O qcow2 "$imageFile.orig" "$imageFile"
done
echo "Warning: Test images before deleting the .orig files"
For convenience I stuck this in my QEMU image directory and made it executable. Be sure to test images and then delete the “.orig” files to save space.
We’re hosting a Code Club community training evening to allow anyone who is thinking of becoming a Code Club volunteer an opportunity to find out more about Code Club and get an insight into what to expect and how to…
Discover MoreThis year saw the launch of a new service from Leeds-based start-up RaceBest Ltd. NewRedo were responsible for building their online system and we continue to host and support it. In building the system we utilised some of the latest…
Discover MoreWe’ve just published an early working version of an on-line service created by NewRedo, however, although written in ASP.NET MVC 2, it’s not running on a Microsoft server. Instead we’re running on Ubuntu 11.10 using the NGINX web server. First,…
Discover More