Tag Archives: VirtualBox

Shrinking VirtualBox VDI Files

Hi, if like me you use VirtualBox for your Microsoft CRM environments you no doubt have at least one crazy large VirtualBox VDI file taking up space on your hard drive.

Today, I thought I would try and trim mine back. I started with a 90GB VDI file and got it down to 65GB.

Here’s what I did:

1. Ran Disk Defragmenter within the VM and defrag’ed the disk. 

2. Ran TreeSize Free within the VM to check for large files/folders that I could trim (didn’t find anything, but did notice the winsxs folder was huge, so did some research on that…)

3. Ran the DISM command line below to purge the winsxs folder (removes data that resides on your disk to enable rollback of service packs, makes your service packs permanent – do a bit of research on this before you decide to do this)

Here’s what I ran:

clip_image002

This reduced the size of C drive inside my VM by 5GB. I think the results you get will depend upon the initial level of your OS and the number of updates you have installed over top.  There seems to be different clean up utilities like this for different OS’s and Service Packs.   I’m no expert on this though.  I ran this over a Windows 2008 R2 SP1 Enterprise Edition install. 

4. Downloaded sdelete to the C drive of my VM and then ran from a command prompt the following command (from c:\ ) sdelete -c -z C:\

This will write 0’s over any unused space on your VM hard disk.  This makes it crystal clear that that unused space can be purged.

5. Shutdown my VM.

6. Opened a command prompt on my host machine and changed directory over to the VirtualBox program folder (C:\Program Files\Oracle\VirtualBox).  Ran the following command to ask VirtualBox to compact my VM’s VDI file:

VBoxManage modifyhd –compact "D:\VirtualBox\CRM 2011 on SQL 2008 DEV Image\Hard Disk\CRM2011 DEV Image (64-BIT Win2008R2  SQL2008R2).vdi"

That’s it.   Oh, and the VM still launched afterwards Smile

Advertisements

VirtualBox Network Configuration for Microsoft CRM 2011

I tend to live inside VirtualBox VM’s whenever I’m working on CRM presales or projects.  For the most part I work inside a single box solution where I have 1 VM running as Domain Controller, SQL Server and CRM Server.  I also tend to have the CRM Outlook Client installed, hooked up to a Hotmail account.  My host machine has 8GB RAM and 4 cores, I allocate the VM 4.3GB and 2 cores.  This generally works well. 

Every now again though I want to add a second VM to this environment, either to isolate a CRM Server component like the Asynchronous Service or to add a Windows client machine to the environment.  

Now things get tricky as we have to start understanding VirtualBox networking.   Well that doesn’t appeal to me, so instead here’s a cheat sheet you can follow to network your 2 VMs together and retain internet connectivity. 

Thanks to my Avanade colleague Safiulla MohamedAli for helping me out with this…


On your CRM server you need to have 2 network adaptors defined.   Adaptor 1 should be defined as per below:

image

(this gives us internet connectivity by piggy backing off of the host machine)

And Adaptor 2 should look like this:

image

(this adaptor connects the VM to an internal network called “intnet”)

If you already have 2 adaptors defined you can edit these whilst the VM is running via the Devices menu option.  Otherwise you will need to shutdown your VM and then set from the Oracle VM VirtualBox Manager:

image

Inside the VM we need to do a couple of things. 

  1. Open the Network and Sharing Centre
  2. Click change adaptor settings
  3. Right-click on the second adaptor and select Properties
  4. Set the IP addresses as per below:

image

What we are doing here is assigning the CRM Server a fixed IP address and telling it to use the locally installed DNS server.

Ok, good, we’re done with the CRM Server. 

Switch over to your second machine.  In my case, my second machine is a Windows XP SP3 VM (assigned 1GB RAM and 1 core).

Here again we need to have 2 adaptors.  The first should look like this:

image

(this gives us internet connectivity by piggy backing off of the host machine)

And the second adaptor should look like this:

image

(here we are connecting this VM to our “intnet” internal network, where the CRM Server is also connected).

Again, we need to go and tweak the adaptors…

  1. Open the Network and Sharing Centre
  2. Click change adaptor settings
  3. Right-click on the second adaptor and select Properties
  4. Set the IP addresses as per below:

image

What we are doing here is giving this machine a fixed IP address and then telling it to refer to the CRM Server for it’s default gateway and DNS server.

And we’re done.  We should now have both VMs sitting on the same network and both enabled for internet access.

There may well be other ways to do this and this might not be the best way.  But it works for me!  Hope this helps someone.

Smile