KVM/QEMU thin provision sanal disk oluşturma

Eğlencelik16/11/2015




If you want to create a Thin Provisioned disk and actually want to use it ;-) You need to add:
-o preallocation=metadata

My following example I would like to create 2 disks for my Satellite (lab) host. (I would not thin provision my production Satellite server - for a number of reasons).  I am building a test Satellite on my laptop which introduces some additional caveats.
notice that 199M is consumed, but when you view the files, they appear to be 120Gig total.



SATHOSTNAME=RHNSAT01


OSDISKSIZE=18


APPDISKSIZE=100



qemu-img create -f qcow2 -o preallocation=metadata /var/lib/libvirt/images/${SATHOSTNAME}/${SATHOSTNAME}.img ${OSDISKSIZE}G
[root@neo ~]# df -h /var/lib/libvirt/images/RHNSAT01
[root@neo ~]# ls -lh
[root@neo RHNSAT01]# qemu-img info RHNSAT01-app.img
[root@neo RHNSAT01]# qemu-img info RHNSAT01-app.img
[root@neo RHNSAT01]# qemu-img info RHNSAT01.img



qemu-img create -f qcow2 -o preallocation=metadata /var/lib/libvirt/images/${SATHOSTNAME}/${SATHOSTNAME}-app.img ${APPDISKSIZE}G






Filesystem            Size  Used Avail Use% Mounted on


/dev/mapper/vg_neo-VM_RHNSAT01


                       60G  199M   56G   1% /var/lib/libvirt/images/RHNSAT01




total 19M


drwx------. 2 root root  16K Jun 25 11:33 lost+found


-rw-r--r--. 1 root root 101G Jun 25 13:13 RHNSAT01-app.img


-rw-r--r--. 1 root root  19G Jun 25 13:13 RHNSAT01.img




image: RHNSAT01-app.img


file format: qcow2


virtual size: 100G (107374182400 bytes)


disk size: 16M


cluster_size: 65536




image: RHNSAT01.img


file format: qcow2


virtual size: 18G (19327352832 bytes)

disk size: 3.0M
cluster_size: 65536