Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

How do I create a .img file or any disk image to be used with KVM?

share|improve this question
go on - give us a clue - KVM? In my line of work it is an acronym for "keyboard-video-mouse" ! – fossfreedom Aug 4 '11 at 9:20
Kernel-based Virtual Machine. – Oxwivi Aug 4 '11 at 9:27
up vote 4 down vote accepted

qemu-img should do the trick - for example:

qemu-img create -f qcow2 test.img 2g

Creates a 2GB qcow2 format image.

See man qemu-img for more information

share|improve this answer

you can create sparse file:

undefine@uml:/var/vm$ dd if=/dev/zero of=plik bs=1M count=1 seek=1000
1+0 przeczytanych recordów
1+0 zapisanych recordów
skopiowane 1048576 bajtów (1,0 MB), 0,00540732 s, 194 MB/s
undefine@uml:/var/vm$ ls -l plik
-rw-rw-r-- 1 undefine undefine 1049624576 lis  9 19:40 plik

and use it as image.

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.