Posts

Showing posts from October, 2015

Reclaiming Free Space in Centos 6 / RHEL 6 VirtualBox Disk Images

Image
Background Using virtualization has its benefits, but also has its shortfalls. For example, creating and deleting files in a virtual disk could make disk usage larger than what it is supposed to be. For example, disk usage of filesystem /dev/sdb1 in the VM is 45 GB. But the virtualbox disk image (VDI) size is 57 GB, as shown below : The VDI (cdh-node1_secondary_hdd.vdi) is about 57 GBs, yet the usage in /dev/sdb1 is 45 GB. So there is about 12 GB of wasted space. The cure Reading various posts, the cure seems consist of two steps : run zerofree to fill unused spaces with zeros run vboxmanage with option --compact The reference could be read in several blog posts (for Vmware :  here , here  , for VirtualBox :   here  and here ) .  But the caveat is, there is no zerofree rpm for RHEL 6. One of the blog posts hinted that we could create one by recompiling zerofree Source RPM (srpm) for Centos 5. Running zerofree First, obtain the source rpm : Using RPM sear