Clearing unused space from a virtual hard disk

If you’re using Hyper-V, and you have a dynamic virtual hard disk (VHDX), then when you delete files from it, the file size won’t shrink automatically.

A great, quick way of getting things downsized is here:


Run an administrative command prompt
Type “Diskpart” (No Quotes)
Type the following commands:
select vdisk File=”I:\path\to\your.vhd”
attach vdisk readonly
compact vdisk
detach vdisk

Airplay with Shairport on Raspberry Pi

The fun I had with this one!

The goal: to get Airplay working on my Raspberry Pi.

The rationale: turns out that my HP Microserver (N40L) doesn’t support the hardware extensions needed to pass-through a USB sound-card to VMWare ESXi 5.5, in order for it, in turn, to pass that to the VMs.  So, my goal of having a Windows VM running iTunes, Spotify etc. and playing that through a long (15m) 3.5mm cable in a #8 fencing wire approach to extending my media upstairs has come up short.  Ha, ha.

So, my backup plan?  I have a Raspberry Pi sitting right beside the Microserver (with a very long HDMI cable for extending same said video media upstairs).  Maybe I could use that, I thought.

The plan: the Raspberry Pi is running RaspBMC (an awesome distro), and I thought it worthwhile to use a USB soundcard (specifically, a Creative Sound Blaster USB stick) to improve on the not-so-flash audio that comes out of the native 3.5mm jack.

Enter Shairport – a port of Airplay that can run on a Pi.

This site has most of the instructions needed to download and compile the Shairport source, including the additional instructions when using Raspbmc as a base.

From there, the gotchas I uncovered:

  1. The SoundBlaster seemed to have dramas with rubbish sound when the analog input (default) was selected, but no problems when what ALSA identifies as the S/PDIF input.  So, to use that, I had to create a /etc/asound.conf file that contains the line pcm.!default front:U0x41e0x30d3 and nothing else.  The U0x… is the identifier of the SoundBlaster that I got from using the aplay -L command, along with the iec958 which is the identifier of the S/PDIF input.
  2. I found I didn’t need to have the options snd-usb-audio nrpacks=1 line in the /etc/modprobe.d/alsa-base.conf file, so that’s good.
  3. Still some noise coming through the soundcard, so I used alsamixer and alsactl store 0 to mute and save the changes to the Mic input.
  4. The final key to getting rid of the noise as best I could was to add the line dwc_otg.speed=1 to the /boot/cmdline.txt file which, I think, slows down the USB ports to cut back noise.

What a drama! But now I have it (mostly) sorted and stable, and receiving pretty good sound from a VM with a hi-fi virtual audio cable and AirFoil.

Not too bad.

Accessing disks in a VMWare VM

When you have disks sitting in a VMWare vSphere/ESXi box that are formatted NTFS, and you want to access them from inside a VM, you need to look at Raw Device Mapping (RDM).

What it took more than a little time to find out is that for SATA disks (i.e. not in a SAN or RAID config), you need to create “pointers” first.  Great instructions are available here. But, in essence, you’re looking to make a couple of calls like:

vmkfstools -z /vmfs/devices/disks/[long weird name of disk got from ls -l in /dev/disks] /vmfs/volumes/[name of datastore]/[sub folder]/[name of disk].vmdk

Silent Hyper-V

Turns out that VMs in Hyper-V can’t handle sound unless you’re using RDP.  So, if you have a sound-card in the server that you’re wanting to use, you can’t access it.


So, I’m turning back to VMWare.

Remote permissions in Hyper-V

Continuing the journey towards Hyper-V server, I’ve found some tricky challenges with remote management of the server from a Windows 8 PC when said PC is not on a domain, but is in a workgroup.

This site has the answer I needed – in essence, enabling the anonymous user on the client and then changing some firewall rules on the server. I actually couldn’t get the Firewall snap-in to work, but continuing to issue commands in text worked for me.

Also, this site has 12 steps for remote management: