Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was trying to create a raw image with this command:

qemu-img create -f raw -o size=200G,preallocation=metadata file.img

but seem that it raw images doesn't support preallocation. if so why there is raw + preallocation in this chart?

# qemu-img create -f raw -o size=200G,preallocation=full file.img
Unknown option 'preallocation'
Invalid options for file format 'raw'.
share|improve this question

raw images do not support preallocation, qcow2 and qed-images do:

preallocation=full instead of preallocation=metadata does not only allocate metadata for the raw image, but also writes zeros to it, thus creating a non-sparse image file.

If your filesystems supports sparse-files (e.g. ext, xfs, btrfs), blocks filled only with zeros are not stored physically, that saves space at the beginning of using this image.

If you would like to allocate all space on the raw image, you can use the dd command: dd if=/dev/zero of=file.img bs=1M count=204800

If you are working towards speed, also use cache=writethrough with e.g. libvirt, this enhanced speed without loss of data if your physical machine crashes.

share|improve this answer
Thanks but: Unknown option 'preallocation' Invalid options for file format 'raw'. and I heard bad things about write-through. – Zim3r Sep 16 '12 at 12:45
I've edited my previous answer. Regarding writethrough: That enhances performance distinctly, of course the performance improvment depends on many other variables. You may have heard something bad about writeback-caching, as mentioned this is a risk if your physical machine crashes, but this imrpoves perfomance even more. – leoben Sep 16 '12 at 13:10
It may seem counterintuitive, but cache=writethrough really does dramatically reduce performance in a lot of situations. – Michael Hampton Sep 16 '12 at 13:30
In my experience this only has an impact when creating snapshots (which is a known bug) of a qcow2 image, so I deactivate it only for systems I know I will make a lot of snapshots of. I have not experienced a performance decrease in my practical experience, the contrary. It may be that in different enviroments the experience is not good or even worse than without caching, using up to date software may remedy the deficiencies. – leoben Sep 16 '12 at 13:37
up vote 0 down vote accepted

According to this manual, I don't see any preallocation options for raw images.

And also it might be good to take a look at these benchmarks, It seems that any kind of raw images have better performance than qcow2.

and also I've seen many suggestions to avoid write-through caching because of performance issues but I didn't test it myself.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.