To clone a VM which created on sparse image use much more disk space
Problem Description:
A clone of a vm machine uses much more disk space. Doing an ls -al shows the file size being the same, however du -h shows it to be almost 12x larger.
Analysis:
Investigated this issue, it caused by the original VM image file is a sparse file(the files size is 147G-"ls -al", the actual used space size is 13G-"du -lh"). I checked the process on Oracle VM server when performing cloning on Oracle VM, details as following:
dd if /var/ovs/mount/3BC75472B0994CFEA8F973B912977D4E/running_pool/32_ttylinux22/Other Linux 2.6.x kernel-0.img iflag direct of /var/ovs/mount/3BC75472B0994CFEA8F973B912977D4E/running_pool/85_test1/Other Linux 2.6.x kernel-0.img bs 1M
Analysis:
Investigated this issue, it caused by the original VM image file is a sparse file(the files size is 147G-"ls -al", the actual used space size is 13G-"du -lh"). I checked the process on Oracle VM server when performing cloning on Oracle VM, details as following:
dd if /var/ovs/mount/3BC75472B0994CFEA8F973B912977D4E/running_pool/32_ttylinux22/Other Linux 2.6.x kernel-0.img iflag direct of /var/ovs/mount/3BC75472B0994CFEA8F973B912977D4E/running_pool/85_test1/Other Linux 2.6.x kernel-0.img bs 1M
0