Archive for the ‘Uncategorized’ Category

Shrink Your Virtualbox Dynamic Expanding Storage

Sunday, January 17th, 2010

Thanks to Michael Cole’s Blog on Slimming down a Linux VirtualBox machine for this important nugget of knowledge.

I wrote a bunch of files to a dynamically expanding virtual disk in VirtualBox.  After I deleted the files, the dynamic virtual drive on the host was still huge.

This is because the files on the virtual disk are not really gone, they are just unlinked from the file system, waiting to be overwritten with new data.
To get rid of this unwanted unlinked data (Linux), write over them with zeros like so:

sudo dd if=/dev/zero of=/zerofile; sudo rm /zerofile

sudo dd if=/dev/zero of=/zerofile; sudo rm /zerofile

Then shutdown your virtual OS and tell VirtualBox on the HOST machine (Windows in my example) to compress the virtual drive.


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\djh>cd .VirtualBox
C:\Documents and Settings\djh\.VirtualBox>"C:\Program Files\Sun\VirtualBox\VBoxM
anage.exe" modifyvdi CentOS-cf7.vdi compact
VirtualBox Command Line Management Interface Version 3.1.0
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
C:\Documents and Settings\djh\.VirtualBox

That freed up some space, nice!

Unix/Linux: Follow That File

Wednesday, August 26th, 2009

In Linux/Unix command line you can follow a file with tail -f [filename]. As the file is updated, the screen will update. This is handy for following error logs, etc.

I just learned from a co-worker that the ‘less’ command can do the same thing if you hit shift-F while viewing a file. Apparently less does a lot more than I thought! I think point and click interface is making me soft, I need to ‘man’ up and RTFM on some command line goodies.


$man less

CFInNC Conference Registration Open!

Wednesday, August 26th, 2009

Registration opens today! Get registered now for this FREE conference! http://cfinnc.com/
http://cfinnc.com/page.cfm/badges

Javascript: Loop through an associative array

Thursday, March 5th, 2009


for(var i in arr) {
var value = arr[i];
alert("Element "+i+" is "+value);
}