Disk space for Windows developers

While I gladly finished my Windows development detour a while ago, it can’t hurt to share some stuff. It always puzzled me how fast gigabytes of disk space disappear through ordinary Windows usage as a developer. So here’s my non-exhaustive list of places to reclaim disk space:

Temp folders

Windows has plenty of them. In fact, each one surpasses the size of my Linux root file system:-) Let’s start simple:

  • C:\Users\$USER\AppData\Local\Temp

Office caches (mostly Lync data and random crap):

  • C:\Users\$USER\AppData\Local\Microsoft\Office\
  • C:\MSOCache

Whatever that is:

  • C:\ProgramData\Package Cache

SQL Server also has an update cache too:

  • C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap

Don’t forget the System Center Configuration Manager Cache. That’s the thing that your sysadmin fills for you :

  • C:\Windows\ccmcache

Windows Installer Cache

This one can grow really fast.

  •  C:\Windows\Installer

However, you shouldn’t touch that manually. Otherwise all hell may break loose. Instead, use the official Windows Installer Cleanup Utility (deprecated but still usefull)or it’s successor Microsoft FixIt.

TFS-Mappings

In case you still rely on Team Foundation Server, regularly check your mapping folders. Build artifacts tend to pile up there even after removing branches, etc.

Resharper Cache

Visual Studio is useless without, so you’re likely using it too. I was unable to configure the cache size but you can safely delete it once in a while:

C:\Users\$USER\AppData\Local\JetBrains\ReSharper\$VERSION\SolutionCaches

.NET Caches

As with all serious software on Windows, the .NET framework has caches too. Depending on which version you care for (choose between 32bit and 64bit) you may exercise your delete keys in subfolders of:

  • C:\Windows\Microsoft.NET\Framework
  • C:\Windows\Microsoft.NET\Framework64

As an example, drop these for .NET-4.5-something:

  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SetupCache
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

The pagefile

Yes, a classic! Windows loves to have a big pagefile because it always tries to get as many dirty pages on disks as possible. So in my case it had a (Windows-managed) size of 17GB. Feels like quite a lot. So depending on personal taste you may want to adjust this here:

pagefile

Suspend to disk

As expected, suspend to disk needs space too. Windows uses a dedicated file, usually around the size of your built in RAM:

  • C:\hiberfil.sys

If Suspend to RAM is good enough for you, you may want to disable it. Open up cmd.exe and issue “powercfg -H off“:

susp

TL;DR

With these rather simple measures, I managed to reclaim around 40GB on a Workstation at work. This can make quite a difference if you’re on a small-ish SSD.

Lync on Mac / Linux

Some of us have to work in a Windows environment at work. Often enough, people use Microsoft Lync to communicate. It is available for other platforms but that doesn’t make it any better. On Mac OS, the most viable instant messenger (IM) option is Adium. It turns out there is a SIPE plugin available for libpurple (the backend for a plethora of IMs including Pidgin). SIPE/SIMPLE is the “Lync protocol”.

Installation

Download and install Adium on your Mac:
Picture1

Then download the SIPE plugin. On a Mac, SourceForge will offer the Adium plugin by default.
Picture2
Once installed, you should get a success message:
Picture3

Account Setup

This step is rather straightforward, add an Office Communicator account:

Picture4

Fill in your mail address as username and your windows login name (including domain):
Picture5

On the Options tab, set the server name to your company’s lync server (i.e. something like lync.office.example.com):
Picture6

That’s it. Confirm the warning about self-signed certificates (A future post will probably deal with the Mac OS cert key chain).

Pidgin on Windows

In case you don’t like the official Lync client on Windows, there’s Pidgin. Download and install it from its homepage. Similarly to Adium, download and install the SIPE / SIMPLE plugin for Pidgin from SourceForge and follow the above guide. BTW. it’s the same on Linux😉

eBay’s funny mail restrictions vs. the plus extension

Since eBay recently lost a complete database dumb, I thought let’s join the other 145 million guys and change me good old password. While doing that I wanted to update my mail address too. BTW, I recently changed to mailbox.org and I am very (very very) happy with it. Unfortunatley though eBay’s very (very very) secure e-mail address validation disallows having the eBay username as localpart (as in localpart@domain.com). Wow I thought, that is what I call secure by default! Funny side note, my old e-mail address also includes my eBay user name, but nobody complained about that some 10 years ago. Well then I thougth, let’s check support. After almost going nuts in their craptastic present-stupid-solutions-but-avoid-revealing-the-bloody-support-form manor, I went for the (free) hotline. So after a 28 minutes long patience test (which I obviously won), I was told by a very friendly lady that she isn’t allowed to change the mail address by hand. German data security laws, she said. Fuck that, I thought:-) She also recommended not using this mail address😉 But that led me to suddenly remember that mailbox.org supports the plus-extensions (or whatever it’s called in the RFCs). So I ended up trying username+ebay@mailbox.org and it worked! So kudos to eBay for not disallowing plus signs in mail addresses (no sarcasm here, many services do). Even better, the next time they loose all their users data, spammers will only get the alias address and I can just block that. Nice!

GoDaddy DynDNS for the poor

Recently, I bought a fresh new domain from godaddy.com for my personal homepage that hosted on a server at home. Admittedly, I didn’t really spend any time on customer satisfaction or the stuff they support, they just had the cheapest offer for a .me domain:-) So after getting used to their cluttered web interface, I discovered they don’t support dynamic DNS in any way. In such a case, you have several options:

1. Transfer the domain to a registrar that offers dynamic DNS service

The obvious though costly solution if you just bought the domain. It can also take months to complete so that usually a non-option.

2. Use a CNAME and point it do a your DynDNS provider-supplied domain

However, this means only a subdomain (usually www) would point to your dynamic DNS domain. As an example, this is how it would look in my case:

www.peilicke.me -> duff.i324.me

There’s a simple guide in the GoDaddy forum to achieve that with their web interface. But that means wasting the actual domain, not nice.

3. Use the name servers of your DynDNS provider

GoDaddy (and other registrars) allow to replace the name servers and you could use those from your DynDNS provider given they allow it. This is how you could do it with dyndns.org. However, they started charging for that a while ago, to bad.

4. Do it yourself

You only need a script that discovers the public IP assigned to you by your ISP and write a little screen-scraper that logs into go GoDaddy’s ZoneFile Editor ™ fills and submit the A record form. Turns out that other people already had (and solved) those issues, so this is how it could look like:

#!/usr/bin/env python

import logging
import pif
import pygodaddy

logging.basicConfig(filename='godaddy.log', format='%(asctime)s %(message)s', level=logging.INFO)
GODADDY_USERNAME="@USERNAME@"
GODADDY_PASSWORD="@PASSWORD@"
client = pygodaddy.GoDaddyClient()
client.login(GODADDY_USERNAME, GODADDY_PASSWORD)

for domain in client.find_domains():
    dns_records = client.find_dns_records(domain)
    public_ip = pif.get_public_ip()
    logging.debug("Domain '{0}' DNS records: {1}".format(domain, dns_records))
    if public_ip != dns_records[0].value:
        client.update_dns_record(domain, public_ip)
        logging.info("Domain '{0}' public IP set to '{1}'".format(domain, public_ip))

Depending on where you want to run the script, you may need to fetch the dependencies. In my case it’s running on a Synology DiskStation 213. Underneath it’s amazing software stack is an embedded Linux with Busybox. Luckily, it already has a Python interpreter, so for me a wrapper script looks like:

#!/bin/sh
OLD_PWD=$PWD
ROOT_DIR=$(dirname $0)
cd $ROOT_DIR
if [ ! -d .venv27 ] ; then
  curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.tar.gz
  tar xvfz virtualenv-1.9.tar.gz
  python virtualenv-1.9/virtualenv.py .venv27
fi
source .venv27/bin/activate
pip install -q --upgrade pif pygodaddy
./godaddy.py
deactivate
cd $OLD_PWD

Since your ISP will cut your connection every 24 hours (usually during the night), you would want to continuously run this script by putting it into /etc/crontab. On the DiskStation, you have to use tabs, not spaces and you have to restart crond after editing (It’s explained in the German wiki):

<br />*/5 * * * * root /path/to/godaddy.sh<br />

That’s it.

UPDATE: The code is now versioned on github: https://github.com/saschpe/godaddy-dyndns

Hard disc benchmarks and data safety

Out of a discussion with darix regarding optimal hard disc layout (using RAID levels and LVM), I happened to benchmark my setup with bonnie++. The machine runs openSUSE-11.3 with the 2.6.34.7 kernel. Storage-wise it has two identical Samsung HD103UJ 1TB discs using Intel Matrix Raid. The main area of the discs use RAID-0 to max out performance. To be blunt, I don’t believe in RAID-1 security at all. IMO 99% of all disc failures are caused by human errors. A big portion of the rest goes to the mainboard controller (your real single point of failure). The remainder can be covered by regular backups to external media. That said, here’s the disc layout:

As you can see, basically everything that matters runs on a RAID-0. The backmost part of the discs is a RAID-1 backup partition that is only mounted occasionally (for writing backups). This assures moderate data security (way better than RAID-1 for your root-filesystem alone) but still depends on occasional external backup. However, the main advantage of this layout is that it is fast. Long story short, here are the numbers:

Maybe not as awesome as this HPC machine, but still quite nice:-)