When we recently set up a new Linux web host, I had to configure two 4TB disks into a RAID1 (mirrored) array.

I created whole-disk partitions on the two disks using fdisk, created the array with mdadm, created an ext filesystem on it, and mounted it. Job done, right?

Unfortunately, some time later we noticed the filesystem was only 2TB, not 4TB as we’d expected. This turned out to be caused by a limit on the size of the old-school PCDOS partitions fdisk can create. The fix was to use parted and GPT partitions instead.

I wondered whether it was possible to do this without destroying the array… long story short: it is. (I did back up the data first as a precaution.)

The plan:

  • remove one disk from the array
  • repartition it with parted
  • re-add it to the array
  • sync the array
  • remove the other disk from the array
  • repartition it with parted
  • re-add it to the array
  • sync the array
  • grow the ext filesystem to use the expanded space

Here are the commands, in this case for an md device /dev/md3 made up of /dev/sdc1 and /dev/sdd1:

Remove one disk from the array:

mdadm /dev/md3 --fail /dev/sdd1 --remove /dev/sdd1

Create a gpt partition using most of the disk (the page I copied this from said it would leave 1MB unused at either end):

parted --align optimal /dev/sdd
mklabel gpt
mkpart primary 1 -1

Re-add to the array:

mdadm --add /dev/md3 /dev/sdd1

(This caused a re-sync but it was very quick, which I found surprising; shouldn’t it have had to copy 2TB of stuff?)

Repeat the above for the other disk.

Grow the RAID array:

mdadm --grow /dev/md3 --size=3815318M

(I got to that figure by repeated grows in a binary-chopish fashion. parted reported the partition at 4001G, but passing this to the grow command yielded ‘no space left on device’.)

Finally, resize the filesystem:

resize2fs /dev/md3

It seems that with Yosemite, Apple have decided to change the system font from Lucida Grande to Helvetica Neue.

Perhaps on retina screens it looks lovely, but on my 2009 MacBook Pro it’s a step backwards in terms of legibility. (For example, the ‘i’s and ‘l’s in “legibility” are a bit of a blur.

Alas, it seems you can’t revert to Lucida Grande. However, you can improve the appearance of text in applications that use the default system font. (For me, that’s primarily Firefox and Thunderbird.)

  • Download TinkerTool
  • In the Fonts section, change the Application font to Lucida Grande 12pt
  • Restart your applications (or your system)

This doesn’t seem to fix the Finder, but suddenly my Firefox tabs are a lot more readable.

Edit: I’ve since found which lets you install a new font in such a way that it replaces Helvetica Neue as the system font. How does it work?

These Fira fonts have a special name table with names identical to those of the system fonts. Because the font folder /Library/Fonts takes precedence over the fonts which are in /System/Library/Fonts, these specially crafted fonts are used for the user interface instead of the real system fonts. The original system fonts are not deleted or modified in any way.

The font is rather pleasant too. Perhaps there’s a way to copy Lucida Grande and modify it to replace the system font in the same way?

I used to back up my DVDs with RipIt, but found that it couldn’t handle some DVDs that MDRP could, so I switched. Whereas RipIt extracts the DVD contents to a .dvdmedia folder (playable by Apple’s DVD player application), MDRP has an option to rip the DVD to a single .iso file, which is playable in VLC and XBMC.

I then wanted to convert my .dvdmedia folders into .iso files. In theory a .iso is just a file container, so my first attempt was to use Disk Utility to make a CD .img of the folder and then rename it to .iso. This kind of worked, in that VLC did begin to play something when pointed at the .iso, but there were weird issues – no DVD menu, no audio, or the wrong language.

It turns out that the structure of the .iso is important, and just dumping the DVD files into it isn’t good enough. I found a forum post out there (which unfortunately I can’t find again) which pointed me at a command line tool called mkisofs, which I was familiar with from work when mastering multimedia CDs for replication.

Unfortunately mkisofs isn’t available by default, but you can get it from the Homebrew package manager.

Once installed, the command you need is

mkisofs -dvd-video -o output.iso input.dvdmedia

It didn’t work for all my .dvdmedia rips, but did for most.

If you’ve used jquery, you’ll be used to attaching click events etc to items:

// for <a class="delete" href="{url}">, get user confirmation
// before navigating off to {url}

$('a.delete').click(function () {
    return confirm('Really?');

Sometimes though, the items you want to attach behaviours to don’t exist yet (e.g. because they’re created and destroyed dynamically in response to UI interaction).

You could attach the behaviour at the point you create the new element, but if you’re doing that in several places, you’ll have the same code in various places. Plus, your implementation of the behaviour for one kind of element will be buried inside the implementation of the behaviour of some other kind of element (or refactored into a function in some more public scope than it ought to be).

It turns out that jquery has a method .on() which allows you to attach event handlers to elements that may or may not yet exist:

$('body').on('click', 'a.delete', function () {    return confirm('Really?');});

The documentation explains how this works (attaching the handler to some parent element — the body element in the above example — and using browser event bubbling to catch events originating on the selected children).

It’s quite nice, you end up with quite a clean pattern whereby you create elements with a CSS class for which you have previously defined the behaviour using .on().

I was processing a UTF-8 dataset where the performance copyright symbol (Unicode code point 0x2117) had been entered as ASCII “(P)”. I wanted to replace this sequence with the actual symbol, but I didn’t know how to create an arbitrary UTF-8 character. After a bit of googling (more than 5 mins, otherwise I wouldn’t be posting!) here’s the answer:

txt = re.sub(r'[(]P[)]', unichr(0x2117).encode('utf-8'), txt)

This is probably one of those things that Microsoft admins just know, but I didn’t, and couldn’t find the answer by Googling…

If you want to share a folder on Windows 2003 Server but the usual Sharing options just aren’t there, either in the right-click menu or the Properties dailog, then open up the Services control panel and check that the “Server” service is running.


For a while I’ve been using IETester for testing websites in older versions of IE.

Recently I had an issue with HTML inputs of type “file” not rendering correctly:


Suspecting that it might be IETester, I downloaded the IE8 virtual machine from Microsoft. Virtual PC is a free download for Vista Pro, and built in to Win7 I believe. The link’s at the bottom of the page. The only thing I need to do to allow the VM to see the website was to set Virtual PC’s networking mode to ‘NAT’.

So if you’re having the same issue, and you’re not using a stock IE8, try the VM before wasting too much more time.

Incidentally – although VirtualBox can boot from .vhd files, I didn’t have much luck in this case, I had to use VirtualPC.

%d bloggers like this: