I have created centos guest image with 40GB as the Harddisk with Thin Provisioning (disk size is not preallocated) and the disk content are stored on a single file. I installed CentOS on this image. Now, when I see the entire size of this image is close to 10GB. But actual usage is around 7GB. I want to shrink the freespace so that the image size is reduced to 7-7.5 GB Max (slightly more than the actually used space)
Following is the output of the used space.
[root@oncommand ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 32G 6.9G 23G 23% /
tmpfs 252M 0 252M 0% /dev/shm
I tried defragging and compacting the disk but not much space was reduced. Are there any ways to shrink this to 7 GB ?