4

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

Oxwivi
  • 17,849

2 Answers2

9

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

Oxwivi
  • 17,849
jamespage
  • 1,124
0

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.

undefine
  • 478