Safely Shrinking VMware Server / Workstation .vmdk Files

VMDK_File_Format_icon

If like me, you originally implemented some of your VMs in VMware Server (or Workstation) as thick provisioned, and have subsequently changed your mind, the process for converting them back to thin is very simple. In my case, the driver was the purchase of a couple of new SSDs, which obviously have a lot less space than my old 7200RPM SATA disks, but the performance is obviously significantly better.

The process of migrating to a new datastore and shrinking / converting the VMDK files to thin provisioned, is as follows:

  1. Create your new datastore directory on the new drive and specify the location in VMware Server (if required), e.g.
    D:\VMs
  2. Create a new directory for the VM to be migrated, e.g.
    D:\VMs\TestVM
  3. Run the following command:
    “<path-to-vmware-install>\vmware-vdiskmanager” -r “<old-ds-path>\<VM-Name>.vmdk” -t 0 “<new-ds-path>\<VM-Name>.vmdk”
    e.g.
    “C:\Program Files (x86)\VMware\VMware Server\vmware-vdiskmanager” -r “C:\VMs\TextVM\TextVM.vmdk” -t 0 “D:\VMs\TextVM\TextVM.vmdk”
  4. The VM will be converted and copied to the new location with no risk to the original file.
  5. Copy the remaining files from the original datastore location (minus the VMDK / vmdk-flat of course).
  6. Remove the old VM from your VMware Server/Workstation inventory (don’t delete the originals until you have tested the new VM!).
  7. Add the VM back into VMware Server / Workstation using the new datastore location, and start it up, specifying “I moved it” when prompted.
  8. Sit back and enjoy the extra space! :)

Note the same process will work for converting VMDK files between all file types, by simply replacing -t 0 with your preferred option from the list below:

0                   : single growable virtual disk
1                   : growable virtual disk split in 2GB files
2                   : preallocated virtual disk
3                   : preallocated virtual disk split in 2GB files
4                   : preallocated ESX-type virtual disk
5                   : compressed disk optimized for streaming

VCP5 Exam Prep

vSphere-5-Box

So its that time of year again, when we VCPs have to bone up on the latest developments in the VCP world and get our exam done in time before we have to go cap in hand to our line management asking for them to pay for a course we never needed in the first place. In order to avoid this embarrassment, VMware kindly give us the opportunity (as existing VCPs) to pass the VCP-510 exam by 29th Feb 2012, bypassing the course attendance requirement (fair enough!).

As per usual, I have left this pretty much until as late as I feasibly can while still giving time for the (hopefully never required as yet) resit, meaning I am booked in to sit my exam on 1st Feb.

For the sake of others who are also planning to take this exam, I plan to post the links to all of my study aids below, along with any other hints/tips I come across for studying towards the VCP5 exam. If it only helps out one or two people it’ll be worth the effort.

This should be considered a “living list” for now, and I will endeavour to update it as I find/use further resources.

  • Mastering VMware vSphere 5 by Scott Lowe (Kindle Edition)
    A superb resource. Even though I am already VCP3 and 4 certified, it is still worth a full read, in part as a refresher, and in part because it does highlight many of the updates with vSphere. Kindle edition is also cheaper, and lets be honest, as vSphere 5 will be out of date in another couple of years, do you really need 2 kgs of dead tree choking up your bookshelf, when you could just have an electronic copy, which you can share across all your devices?
    I have spent an hour or two a night reading and taking notes from this for the last couple of weeks, which is a lot less painful than trying to get through it in one go, and hopefully should ensure slightly better retention!
  • VMware vSphere 5 Clustering Technical Deepdive by Duncan Epping and Frank Denneman (Kindle Edition)
    Having read the vSphere 4 version of this (first Kindle book I ever bought) in prep for my VCAP-DCD 4 (still to sit), I can confirm Duncan and Frank are very capable teachers! An excellent resource which goes above and beyond the VCP requirements, but will give you a much more in depth understanding of HA, DRS, DPM, SDRS, etc.
  • VCP 5 Exam Blueprint
    If you know all this, then you cant fail!
  • What’s New in vSphere 5.0 Overview
    A quick reminder / highlight list of all the new features in vSphere 5
  • What’s New in vSphere 5.0 – Technical Whitepapers
    Platform
    Storage
    Networking
    Performance
    Availability
    Licensing, Pricing and Packaging
    Particularly useful for a quick reminder skim for all the new features, prior to the exam.
  • Official VMware Mock VCP510 Exam
    An excellent resource, especially if you have never taken a VCP exam before.
  • VCP5 Practice Questions by Paul McSharry
    A great set of practice questions… I actually met Paul when he taught my VMware vSphere Design [4.x] workshop. A very knowledgeable guy, and his website (www.elasticsky.co.uk) is well worth checking out and subscribing.
  • VCP Practice Exams by Simon Long
    A boat-load of questions here coving general knowledge and config maximums per feature.
  • More links to practice questions coming soon…

 

Migration to WordPress

wordpress-logo-notext-rgb-300x300

After some time running my site using Joomla CMS, and testing WordPress for my photo blog, I have moved my main site over to WordPress too. Quite simply WordPress is about as simple as it gets for a CMS, very easy to install, config and update. The other big advantage is the massive theme and plugin selection which is very easy to access and install.

A quick word of thanks to christian_gnoth for his Joomla/Mambo To WordPress Migrator, which made the process of migrating my (admittedly minimal) number of post over, with zero hassle.

Now maybe I should try and actually write some content for a change!

DOS Batch – Date Folder Reverse

Date Directory RenameI came across a very irritating issue today. When doing an import of HD videos using Panasonic’s HD Writer AE, it automatically puts all the files into folders named with a format DD-MM-YYYY (47 of them!).

This would all be fine if Windows realised this was a date, instead of sorting into order by the DD first, but it doesnt. I wasnt about to go through and manually rename all the directories to YYYY-MM-DD so they would sort correcty, so I wrote a quick batch file to do it, and thought it may be of use to some people.

Copy the below into a text file, edit the year (currently 2010) as required, rename to .bat and drop it into the root folder you want to rename the other directories from, then simply double click!

@echo off
@echo This batch file will reverse date formats for any folders in the current dir from DD-MM-YYYY to YYYY-MM-DD
pause

for /D %%i in (*-*-2010) do (
 call :renamer %%i
 )
pause

goto :EOF

:renamer
set var=%1
ren %1 2010-%var:~3,2%-%var:~0,2%

Stop censorship