Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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.