In my last post, I discussed the simple but confusing steps required to add custom icons to Mac OS X drives. I mentioned that there were some tricks to getting custom icons on some drives, however, including Boot Camp and NTFS disks. This week, I’ll show how to customize these as well.
There are two core problems with customizing drive icons for certain volumes:
- OS X can’t directly write to anything but HFS+ and FAT, and this includes writing icons
- OS X needs a special resource on the drive to indicate that the custom icon should be used, and only HFS+ supports this
But it’s easy enough to get around these limitations. Apple takes care of number 2, and we can cover number 1 in one of two ways.
Old versions of Mac OS stored lots of data (aka “resources”) in the resource fork of a file, including icon graphics. However, this became a problem with the advent of networking and cross-platform computing, since no other popular personal computing platform supported two-fork files. OS X moves most resources into the data fork – although resource forks still exist, they are rarely used.
However, it appears to me that although the “icns” data for a drive icon is stored in the data fork of the .VolumeIcon.icns file, Apple still uses a pointer in the resource fork of the root directory of the drive to tell OS X to use that icon. In other words, when a drive is mounted, OS X seems to look in the resource fork of “.” for a flag that says “use the icon in .VolumeIcon.icns” before it will use the icon. I’m not sure this is the case, but I do know that .VolumeIcon.icns has no resource fork (even on HFS+), but it requires a special resource file on other filesystems.
Since only HFS and HFS+ support resource forks, this is a problem. Apple gets around this by saving resource fork data in files with “._” prepended to their name. So the resource fork of “index.html” would be “._index.html” on a FAT drive. Every FAT drive I’ve added a custom icon to includes a file called “._.”, which sounds like the root directory’s resource to me, and this is required for the icon to work.
Getting It Done
So you need two files on a non-HFS+ drive to get the custom icon to work:
- .VolumeIcon.icns – the same exact file as on an HFS+ volume, containing the icon data in the data fork
- ._. – a special file (resource fork, perhaps?) which seems to tell OS X to use the icon
As illustrated previously, adding a custom icon to a FAT drive is exactly the same as on an HFS+ drive – create the icon resource and copy and paste it in the drive’s Info inspector. If we move these two files over to any other OS X-readable drive (including NTFS-formatted Boot Camp partitions), it will use the icon!
OS X can’t write to NTFS, so there are two ways to get these files onto an NTFS drive:
- Make OS X write to NTFS by installing NTFS-3G
- Copy the two files over in an OS like XP or Vista that can write to NTFS
[ad#vmware]The first method is simple, but not one I wanted to try. NTFS-3G is great – it’s a reverse-engineered open-source read/write driver for NTFS, and works on lots of platforms. But NTFS is finicky, and I’m not too keen on risking the integrity of the drive with an unsupported driver. If you want to use this method, though, customizing the icons is as simple as it is with FAT, once the driver is installed.
I used method 2 – relying on VMware Fusion to allow me to write the icon data to my NTFS drives and using a FAT-formatted flash drive as an intermediary between OS X and Vista. I created my icons, applied them to my flash drive, then booted up Vista in Fusion and copied the two files over in a DOS window. They’re hidden by default, but that shouldn’t slow you down.
Note that this only affects the icons in OS X – it will not allow you to customize the boot icons.