Shrink/Compact and Re-size VMWare Image in VMWare Player

Date January 30, 2014

I had an office PC converted into a VMWare image and wanted to reduce the image file after cleaning up unwanted files and applications. The compact command for the HDD will not totally reduce the image file size in the HOST OS.

VM Image OS is Windows XP. For linux, I will assume a different process.

To literally reduce file size in the host OS, what I did…

  1. Free up disk space.
  2. Zero fill freed up space, I used CCleaner
  3. Shutdown the VM
  4. Run again VMWare Player and right click on the VM
  5. Go to Hard Disk and under Utilities -> Compact
  6. Finish the compact phase and start the VM again.
  7. Install any Partitioning software, I used EaseUS.
  8. After completing the installation, re-size the Hard Disk that has the freed up space to a smaller space that you want
  9. Apply the re-reize
  10. Shutdown the VM, the actual size on the Host OS will now have the reduced file size.

You can expand the size again of the partition/hard disk using the partitioning software and it will not affect the actual VM image file size in the host OS until you start adding new files/data into it.

Installing Gitorious in Ubuntu 12.04 Server – How-To

Date January 9, 2013

I wanted to setup my own Git repository locally and with an accompanying front end GUI. Before Gitorious, I installed Git from scratch and also installed Gitolite. That will be another post later on.

Initially I followed the script from http://blog.kyodium.net/2011/09/install-gitorious-on-ubuntu-1104.html but its based on Ubuntu 11.04, there are some missing packages that was not part of the installation script so I had to run the script manually and jump from one tutorial to the other, but the main flow I used is from that script. This is the documentation of the installation process.

Note: I added the PPA to Git’s updated source so I would be using their latest release not Ubuntu’s Git package. ( Google around for Git’s PPA repository, its easy enough ;) )

Also I was not logged into root ( which I prefer, so I had to do a lot of sudo-ing =S )

Execute these line-by-line… please don’y copy everything then go pressing enter.

Update your Ubuntu server to latest patches and install the packages bellow.

sudo aptitude install build-essential zlib1g-dev libcurl4-openssl-dev postfix apg geoip-bin libgeoip1 sqlite3 libsqlite3-dev libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev libmysqlclient-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev openjdk-6-jdk sqlite3 libsqlite3-dev libmagick++3 libmagick++-dev libapache2-mod-xsendfile libxslt1-dev libreadline5 libxslt-dev libxml2-dev imagemagick apache2-dev activemq

Update Ruby Gems
Read the rest of this entry »

Yahoo! Mail SSL Support

Date December 13, 2012

Yahoo! Mail finally has SSL support, or I just noticed it now.
Anyway.. for those who are paranoid or takes security to another level, like me, you can enable SSL support under the Mail Options, under the Options tab. Just enable the check box and save your settings. You need to reload the page as well as clear your cookies after enabling this feature. I had to clear my cookies for the SSL page to load.
Screen shot below.

Untitled

ExtJS/Sencha Paging Event Handling and Custom Parameters

Date November 27, 2012

Sencha ( formerly ExtJS ) has a cool paging toolbar at the bottom of their Grid List component. There are sometimes scenarios that I want to pass values, lets say ID or search terms, for the next/previous page to retrieve. Sadly the buttons ( First, Previous, Next, Last and Refresh ) does not have any onClick event handlers to initialize the parameters before sending to the database. The only thing close to handling this requirement that I found is that you have to set a listener for the beforechange event under Ext.PagingToolbar to initialize the parameters and values before the component sends the data to the server. This way any variables can be set before sending.

The variables that are sent to the server is normally start and limit, what if I want to add a filter to the query? One way is adding baseParams to your data store and change their value using setBaseParam when the beforechange event is fired.

Sample code below.
Read the rest of this entry »

VMWare Sphere 5 Boot Delay

Date January 30, 2012

Update: This will also work for 5.1 and 5.5.

Note, this is a WhiteBox setup so not all parts are officially supported by VMWare. Specs below…

  • i7 2600K
  • Gigabyte P67A-UD4 B3
  • 8GB DDR3-1866hz 9-9-9
  • 1TB Samsung F3 drives
  • Intel Gigabit Network card

Now, the issue here is that after a clean install of VMWare Sphere 5, boot-up would take at least 5-9 min to complete from a clean power-on. Compared to an upgrade from VMWare Sphere 4.1U1 which will load all the necessary drivers right away after a restart/power-on. It seems like its not detecting the HDD at all at first glance but soon found its way. Further tests, experiments and research yielded that this is a side-effect on how VMWare handled their installation process in VMWare Sphere 5 compared to 4.1U1. In 4.1U1, it uses the MBR for the boot process by default, while in 5.0 it uses GPT. You can fixed this if you force the installer to use MBR during the installation phase.
Read the rest of this entry »

Ubuntu 10.04 Server ACPI/APM Support

Date August 17, 2011

Advance Configuration and Power Interface (ACPI) or APM ( Advance Power Management ) support for Ubuntu 10.04 was not installed by default after server installation.  I needed this so that during power outage I can just press the power button to automatically shutdown the PC.

sudo aptitude install acpi acpi-support apm

This will install the power-button-power-off feature in you server.

Enable Built-in Intel 82579 Based Ethernet Card in Intel DH61WW Motherboard under Ubuntu 10.04 Server LTS

Date August 7, 2011

82579 based Ethernet network cards are only supported in Kernel 2.6.36 and up, thus Ubuntu 10.04 LTS will not have out-of-the-box support for the network card. I needed this to work since I’ll be using this as my server and 11.04 is not LTS, I have no choice. To fix this with the motherboard I have from Intel, here are the steps that I did…

  1. Download the driver source from Intel driver webpage here, or the latest one they have. Double check if the driver supports the version of the network card, the one I have is 82579.
  2. Ready the Ubuntu server, install make gcc g++ and linux headers
    aptitude install make gcc g++ linux-headers-`uname -r`
  3. Un-pack the src driver that you just downloaded, compile and install.
    gunzip [filename].tar.gz
    tar -xvf [filename].tar
    cd [folder_name]/src
    make install
  4. If everything goes well, no error should come out, then enable your new ethernet card.
    modprobe e1000e
  5. You can check your new network card via ifconfig
    Enjoy! ;)

Note: If you update your kernel or linux image via aptitude safe-upgrade or dist-upgrade, you need to remove the e1000e module, re-compile the driver and install the newly compiled driver again.

Blocking DNS requests with Shorewall to prevent OpenDNS Bypass

Date June 28, 2011

Here’s a way to block users from using a different DNS address other than your own local DNS server to bypass OpenDNS filtering. I’m currently using Shorewall in an Ubuntu 8.04 LTS server setup as my Firewall, Gateway and DNS, and works nicely. This should also work in 10.04 or other Ubuntu install that has Shorewall firewall. Side effect for the user will be that they wont be able to surf the net until they revert back to the assigned DNS to use.

In your Shorewall Rules file, add this above the other rules.


DNS/ACCEPT  $FW     net
DNS/ACCEPT  net     $FW
DNS/DROP    loc     net
DNS/DROP    net     loc

$FW is your firewall/gateway and in my setup my DNS. You can change $FW to loc:<dns_ip_address> if your DNS is located in another machine other than your gateway.

Have fun raining in on their parade ;)

P.S. You can add filters to allow certain IP or MAC addresses to use DNS outside (i.e. Google DNS ).

Auto Updating OpenDNS with Dynamic IP Address via Ubuntu Server

Date November 5, 2010

I have a linux Ubuntu server and a dynamic IP for the DSL connection. The office needs web filtering and getting a static IP will just add cost to the now tight budget. Looking around there is actually a way to update OpenDNS IP address under linux. Below are what is needed to be installed and configured.

  • Any latest Ubuntu server ( I’m using Ubuntu 10.10 Server )
  • ddclient installed (use “aptitude install ddclient”)
  • net connection, I have set up my linux server as a firewall/gateway

After installing ddclient, go to /etc and edit ddclient.conf, below is the format that I used, modify it to suite your configuration.

ssl=yes
use=web, web=whatismyip.org
server=updates.opendns.com
protocol=dyndns2
login=<openDNS_username_here>
password='<openDNS_password_here>'
<openDNS_network_label_here> #this can be found under settings, just the label, nothing else should be added here

Save the new configuration file and restart the client /etc/init.d/ddclient restart
Also make sure that the network that your going to update the IP address has set its Dynamic IP Update option enabled. This can be found under the advance setting of the network.

Special Character Encoding in XML

Date February 13, 2010

Ran into a problem returning an XML data with special characters encoded into it through an AJAX call. The problem was that special characters (i.e. &ntilde; -> ñ) throws an error when being returned through XML and is in the process of being parsed by the browser.

The catch?
XML does not support named entities by default, you have to declare it before hand. Only &lt; &gt; &amp; &quot; and &apos; are predefined.

Something like:

1
2
3
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
<xsl:stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">

Got this from here…

The fix…
Instead of using named entities in the XML (I think this also affects JSON, I could be wrong since I didn’t test this is JSON) like &ntilde;, use character references to support special character encoding.

Example:
white space = &nbsp; = &#160;
ñ = &ntilde; = &#241;

they are all the same… #160 is referenced/mapped to ” ” and #241 is referenced/mapped to ñ

So when forming your XML before returning it through an AJAX call, form the special characters via character reference.

Hope this helps you out there having this problem.