I’ve got a folder containing thousands of files, mostly PDFs and webarchives. I’d like to burn them on DVD so I can get them off my computer, but when I stick the disc back in I want to search them in a jiffy with the OS X Spotlight utility introduced in Tiger. Fortunately, it is possible to burn a Spotlight index onto a CD or DVD disc.
Create a disk image in Disk Utility
Open Disk Utility and make a “New Image” of appropriate size for what you intend to burn. The following instructions work with both “read/write” and “sparse” disk image formats. After Disk Utility creates the disk image, it will automatically mount it on your desktop, ready to use.
Copy files into the new image, leaving some space
Now you can fill your new image with the files you want to burn. But wait! Leave some space free for the index itself. My first test on about 250MB of PDFs and web files yielded about 12MB of data. Depending on how that scales, that could mean around 200MB for a DVD. This will vary based on what’s in your files, and Spotlight does seem to be able to prune its index to fit into lesser free space if necessary.
Use mdutil and mdimport to index disk
Open up Terminal for the juicy part of this whole how-to. Type
sudo mdutil -i on , with a trailing space. Don’t hit enter just yet, there’s still one more piece to add. Let’s go over what we have so far first. To run Apple’s metadata utility, we need administrator rights, so we start with ’sudo’. (For more information about these tools, you can open a new Terminal window and type
man sudo or
man mdutil.) The ‘-i on’ tells mdutil to turn Spotlight indexing on for the path we’re about to add.
The easiest way to add the necessary volume’s path is to drag the mounted disk image icon (the white device with the slot on the front, not the document with the silver hard disk) into the Terminal window. You should end up with something like this:
sudo mdutil -i on /Volumes/Image\ Name. Now you can hit return on this command, and enter your password to enable administrator rights.
To ensure that your disk image gets indexed right away you can should enter
mdimport /Volumes/Image\ Name and then
sudo mdutil -p /Volumes/Image\ Name. The first command forces an index-while-you-wait. The second makes sure the index data is actually on the drive.
Burn the disc
At this point you can unmount (eject) the disk image. If it’s not open anymore, open the image file (the one with the silver hard drive this time) with Disk Utility. Select the image file in the source list on the left, and click Burn. In a few minutes you should be enjoying a Spotlight indexed archive disc!