for a customer demonstration there was a requirement to build a virtual box
image with Oracle Enterprise Manager Cloud Control 12c. This meant installing OEL Linux 6 as well as creating an 11gr2 database and Oracle Enterprise Manager Cloud Control 12c on a single
virtual box. Storage was sized at 300Gb using dynamically allocated storage for the virtual box and about 10Gb was used for
Linux and the initial build.
copying over all the binaries and performing all the installations the virtual
box became in the region of 80Gb used size on the host operating system, however
internally it only really needed around 20Gb. This meant 60Gb had been used when copying over all the binaries and although now free was not returned to the host operating system due to the growth of the virtual box storage '.vdi' file. Once the ‘vdi’ storage had grown it is not
shrunk automatically afterwards.
always tight on the laptop so it was desirable to shrink the virtual box back
to a minimal size and here is the process that was followed.
Install 'zerofree' Linux
package into the OEL6 virtual box
The RPM was
downloaded and installed from a site similar to below;
internet search for ’zerofree Linux rpm’ was easy to perform and find the
Execute 'zerofree' package on
the desired Linux file system
To execute this package the desired file system needs to be mounted read
only. The following steps outline this
As root: # umount /u01
As root:# mount –o ro –t ext4 /u01
NOTE: The –o is options and the –t is the file
system type found in the /etc/fstab.
Next run zerofree against the required storage, this is located by a
simple ‘df –h’ command to see the device associated with the mount.
As root:# zerofree –v /dev/sda11
takes a while to run but the ‘-v’ option gives feedback on the process.
What does Zerofree do?
purpose is to go through the file system and zero out any unused sectors on the
volume so that the later stages can shrink the virtual box storage obtaining
the free space back.
has completed the virtual box can be shutdown as the last stage is performed on
the physical host where the virtual box vdi files are located.
Compact the virtual box ‘.vdi’
stage is to get virtual box to shrink back the storage that has been correctly
flagged as free space after executing zerofree.
physical host in this case a windows 7 laptop a DOS window was opened.
At the prompt the first step is to put the virtual box binaries onto the
The above shows the current value of the PATH environment variable.
C:\ >set PATH=%PATH%;c:\program
The above adds onto the existing path the virtual box binary location.
The above changes directory to where the VDI files are located for the
required virtual box machine.
modifyhd zzzzzz.vdi compact
zzzzzz.vdi is the name of the required vdi file to shrink.
above command is executed to perform the compact operation on the ‘.vdi’
file(s). This also takes a long time to
complete but shrinks the VDI file back to a minimum size. In the case of the demonstration virtual box
OEM12c this reduced the virtual box to 20Gb from 80Gb which was a great outcome