Zeroing out disk fills RAM of host (linux only)
Posted: 20. Feb 2016, 01:07
Using virtualbox 5.0.14 I am currently zero filling a vm in order to compact the artifact's disk size. It looks like this:
This works great on my mac. Doing the exact same thing on a linux host causes the RAM to fill up on the host machine and the box getting OOM killed. The guest machine seems to be writing directly to the host's memory. There is a 1:1 ratio for zeros written in GB to GB of ram taken up.
So far I have tried to use sync to write data out to disk:
I have also tried to turn hostiocache off:
What am I missing here? Is there anything else I can tweak so I am not caching disk writes on the host's memory?
Code: Select all
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
So far I have tried to use sync to write data out to disk:
Code: Select all
i=0
while [ $? -eq 0 ]; do
i=$(($i + 1))
echo "writing EMPTY-$i..."
sudo dd if=/dev/zero of=/EMPTY-$i bs=1M count=1000
sync
done
Code: Select all
VBoxManage storagectl <vmname> --name "IDE Controller" --hostiocache off