Saturday, 19 January 2013

Shrinking Partitions on Vista

Well, that was significantly harder than expected...

Earlier this week I thought I'd do something that you'd have thought would be quite simple. Setup my old(ish) HP laptop running Windows Vista for dual booting with Ubuntu Studio. Now, the problem may already be apparent in that last sentence: Vista.

Despite all the negative press Vista got, I have to admit when I bought a new laptop 6(ish) years ago it ran fine and I didn't have any real problems. It was only after about 4 years of fairly heavy use that I decided a new machine was needed (both laptop and desktop) and onto Windows 7 I went. Now with the onset of the idiocy that is the Windows 8 interface on a desktop, I've been gradually switching to Linux and have almost managed it thanks to Steam finally going the full penguin. One of the last things that shackles me to Windows was the many options for DAWs (Digital Audio Workstations) but after stumbling across Ubuntu Studio I thought that would be the way forward.

So, having already set up my Windows 7 desktop to dual boot Ubuntu without any troubles (TF2 on Linux. Oh yes.), it seemed that doing a similar thing for Vista would be easy enough. Oh how wrong can you be....

(Note: Obvious caveats should be applied - backup your data, you computer may explode, etc, etc. :))

First step was to clean out as much of the accumulated detritus that always seems to gather on a machine I own. This gave me ~75GB from the 150GB disk. So far so good. Next, was to shrink the partition Windows was running (which took over the whole disk) to provide space for the new Linux partition. So, open up windows explorer, expand Control Panel in the tree view, select Administrative Tools, then go to Computer Management. Select C: drive, right click and go to Shrink.



The gave whole 97MB from the 75GB available. Bugger.

Googling eventually got me to How To Geek which basically described the problem: Windows decides to write important (and immovable when running) files all over the disk with no real care for what it's doing. Instead of keeping these files near the start of the disk allowing the movable files to be put everywhere else and therefore making changing the partition size easy, these unmovable files stop you altering the partition much within Windows and it's *very* hard to do it outside of Windows without bricking your install.

So, long story short, how to get around Vista not allowing you to shrink your partition? As described in the page above, first close all programs (to save memory) disable hibernation:


In Command Prompt (with admin rights) do:

powercfg.exe /hibernate off

Next, disable System restore:


disable the pagefile (swap space by another name - hence the closing of programs above):



Then if you're lucky, installing the free tool Auslogics Disk Defrag and running the optimisation may get you most of the way there:



Note you may come against the System Volume Information folder in the C: drive root which seems to contain old restore points, in which case you'll probably have to briefly live boot into Linux (or whatever) and delete it from there.

If after all that, Shrink still isn't playing ball, you will need to get a bit more serious. The Free Trial of Perfect Disk is what I had to resort to here:


Install it, select your drive, set the defrag to 'Prepare for Shrink' and then select the boot time defrag option (this will hopefully shift the files causing the blockage). After that's done, and just to be sure, finally run it's own online defrag. After all this, running Shrink will hopefully provide significantly more space to free up for other partitions. Note that I still couldn't shrink as much as it said I could as it said 'Access Denied' a lot. However, by this point I'd gained 30GB of unallocated space and thought I'd cut my losses :) Last step is to re-enable the pagefile (a must) and hibernation (if you feel the need).

Now to be fair, this is quite likely a limit of Vista rather Windows in general and it is a rather advanced usecase. However, it does seem a little poor that you have to go to such trouble to manage your disks with Windows :(

Anyway, I will return with a briefer post on installing Ubuntu studio and getting my StealthPlug working as this was remarkably easy (though not entirely trouble free).