Problems bundling EC2 volumes on Amazon Web Services to create images from running instances

I attempted to comment on this LOPSA blog entry about problems bundling EC2 volumes, but for some reason they haven’t approved my comment so I’m turning it into a blog entry here instead.

The problem is that sometimes, when attempting to make an image out of a running EC2 instance, the ec2-bundle-vol command fails for reasons that are not clear. This can be a massive nuisance because you might have made quite a few changes to a running instance which would take significant time to recreate on a new instance in order to make an image from it.

In the LOPSA blog entry, ‘wnl’ has encountered the same problem, and he notices that the BIND nameserver may be causing the problem because, whilst it’s running, it uses a filesystem which is bound to /proc, and /proc is supposed to be entirely excluded from the bundling process. This is potentially borne out by the fact that the problem doesn’t occur when the BIND process (named) is not running.

I’m not running BIND on any of our EC2 instances, but I have sometimes found that stopping other services whilst bundling seems to have decreased the likelihood of the error occurring. So this is definitely something worth bearing in mind and investigating further.

Additionally, I’ve sometimes found that setting the size of the image file to maximum – by adding ‘-s 10240’ to the ec2-bundle-vol command – has stopped the problem from happening. I don’t know why this is, but it’s handy when it works.

So I don’t yet have any definitive answers as to why this happens because I’m still in the process of figuring it all out, but at least some progress is being made, and in the meantime I have a couple of things to try which get around the problem. Hopefully these might come in handy for anyone reading this and having similar problems.