I've been playing with KVM lately. One of the things I'm using it for is to run Ubuntu upgrade tests. I have a virtual machine running dapper with about 7500 packages installed, and run an upgrade to hardy. This finds a number of problems.

In order to manage things properly, I keep a few copies of the virtual machine. For example, before I upgrade, I copy the current .qemu file to another name so that if the upgrade fails, I can easily get back to where I was.

The .qemu file is currently about 30 gigabytes, so all this copying takes a fair amount time and space. While waiting for the copy to finish, I find myself wishing for copy-on-write files.

It would be awesome if the kernel could mark blocks in files as copy-on-write when I copy a file. This way, the blocks would not need to be copied until something actually writes to them. The initial copying would then only take mere fractions of a second, rather than minutes.

I know I could kludge this with LVM snapshots, or Qemu snapshots, or Qemu base images, or some other ways, but they make things complicated, and are not particularly generic.

This is not actually specific to Qemu/KVM either. There's all sorts of things this could be used for. Any time you want to this kind of manual version control. Version control systems. Rolling back entire systems after a failed upgrade. Automatically snapshotting each user's home directory every night, as a local, low-safety backup. Implementing transactions when using filesystems as a database.

Now if only I had the time to become a kernel hacker...

Edit: Old discussion page.