Burn Spotlight index onto a DVD
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!
Excellent tip, thanks.
Any idea if it’s possible to create an index after the fact? That is, an index of a burned DVD that stays on the HD and remains searchable. I’m thinking the path of any files that come up in a search would contain the volume name, which I’d label the DVD with so I know where to find it.
Wishful thinking. Maybe I should submit a feature request to Apple.
Comment by jm — March 10, 2009 @ 7:07 pm
So I just went ahead and gave it a shot – turns out you can index a read-only volume. I ran (as root) “mdutil -i on /Volumes/DVD\ Volume\ Name\ Here” followed by (as my user) “mdimport /Volumes/DVD\ Volume\ Name\ Here”.
I didn’t actually finish the indexing process because spotlight’s gui reported that it’d take ~12000 hours to finish! That number actually started low then continuously grew until I decided to stop the indexing. Anyhow, after I stopped I ran a spotlight search for something I knew would be on that volume and some files actually came up, even listing the volume name at the beginning of the path.
Comment by jm — March 10, 2009 @ 8:14 pm
I just found out that the search only works when the volume is mounted! I guess that should have been obvious. Oh well.
Comment by jm — March 10, 2009 @ 8:19 pm