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: https://fiddley.wordpress.com/2014/01/27/dynamically-expanding-vhd-not-compacting-in-hyper-v/

Specifically:


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

Symbolic linking in Windows to clear up space

My laptop is running Vista 32-bit at the moment, and the C:\Windows\Installer directory is over 5GB big! Not too pleased about that, I set about trying to find a way to either delete it or move it to my bigger D:\ partition.

I found a great link on cloud.net that mentioned Junction – a free app that allows the new(ish) symbolic link functionality to work in Windows.

Using it, I was able to move the whole folder to the D:\, and then use the command

junction C:\Windows\Installer D:\Windows\Installer

to trick Windows into thinking that the folder is still there.

Something I’m used to doing on Linux, but not Windows.

Outlook 2007 and task craziness

Having recently set-up a new machine, it’s all the little configuration settings that you forget and that annoy you the most!

Take, for example, Outlook 2007’s annoying “feature” of making any mail that is flagged anything appear as a Task in Task folder.  For a GTD nut like me, this is really annoying.

Luckily, howtogeek.com has a great tutorial on how to use the filter function to set the “In Folder” field to be “Tasks” and that will solve the problem.

Back to actually doing those tasks now…

Keyless SSH entry – Ubuntu, Windows and iPhone

A great feature of SSH is the ability to log in using public/private key encryption, rather than just simple passwords.

The way this works is that each server and client creates a public and a private key. Then, you copy the public key of the client you wish to authorise into the authorized_keys file of the server you are logging on to. When you attempt to log in, your SSH client will create a signature using your private key which the server will then decrypt using the public key and you’re in. 🙂 Easy. (More details here.)

Because your keys should be encrypted, this doesn’t remove the need to enter a password when you use the key. To do that, you need to use Paegant – a free accompaniment to Putty in Windows – which will ask for your passphrase once and then use it to open sessions to your heart’s content.

To get this working, you:

  1. Generate the key pair on the client using PuttyGen. Specify a decent passphrase for your private key.
  2. Copy the public key to the clipboard or export to a file
  3. On the server, for the user you are planning to log in as, go to ~/.ssh/ and edit the authorized_keys (or authorized_keys2) file
  4. Paste in the public key RSA string
  5. In Putty, for the server connection, add the username to the Connection > Data > Auto-login username field, and the path to the private key file Connection > SSH > Auth > Private key… field.

Done. 🙂

For the iPhone iSSH app, the app has a generate public key function. With that you can follow the same instructions to authorise the key and it will work from your iPhone as well. Sweet!