Here’s a way to let spotlight do a full content index of a read only CD. It can even persist across uses :)
#!/bin/sh # pass in the name of the r/o volume, e.g. DiskWarriorCD # this is proof of concept only. seriously :) if [ ! $1 ] ; then echo "supply a volume name" ; exit 1 ; fi vol=$1 rodevpath=`df | grep "$vol" | awk '{print $1}'` fspath=`df | grep "$vol" | awk '{print $6}'` sudo hdiutil unmount $rodevpath sudo hdiutil mount $rodevpath -shadow "/tmp/$vol.shadow" sudo mdutil -i on $fspath sudo mdutil -s $fspath
I’m then able to return documents on the CD in my spotlight searches, create new files on the CD (in the shadow file) that are also indexed, etc…
{7} andre@idio [~] % rwmount Warrior "disk2s1s3" unmounted successfully. /dev/disk3 /Volumes/DiskWarriorCD /Volumes/DiskWarriorCD: Indexing enabled for volume. /Volumes/DiskWarriorCD: Status: Indexing Enabled {8} andre@idio [~] % echo "nice marmot" > /Volumes/DiskWarriorCD/motd.txt {9} andre@idio [~] % mdfind marmot /Volumes/DiskWarriorCD/motd.txt {10} andre@idio [~] % mdfind 'rebuild' -onlyin /Volumes/DiskWarriorCD /Volumes/DiskWarriorCD/Applications/Utilities/DiskWarrior CD Extras/DiskWarrior AppleScripts/Rebuild Directory /Volumes/DiskWarriorCD/Applications/Utilities/DiskWarrior Manual.pdf /Volumes/DiskWarriorCD/Applications/Utilities/DiskWarrior Read Me.rtf /Volumes/DiskWarriorCD/Applications/Utilities/Quick Start Manual.rtf /Volumes/DiskWarriorCD/Applications/Utilities/DiskWarrior CD Extras/DiskWarrior 3 Brochure.pdf /Volumes/DiskWarriorCD/Applications/Utilities/DiskWarrior CD Extras/DiskWarrior AppleScripts/DiskWarrior and AppleScripts.rtf {11} andre@idio [~] % mount /dev/disk0s3 on / (local, journaled) devfs on /dev (local) fdesc on /dev (union)on /.vol /dev/disk1s3 on /Volumes/Bay (local, journaled) automount -nsl [180] on /Network (automounted) automount -fstab [184] on /automount/Servers (automounted) automount -static [184] on /automount/static (automounted) /dev/disk3 on /Volumes/DiskWarriorCD (local, nodev, nosuid)
( physical CD is at disk2 )
( click eject button of DiskWarriorCD in Finder to unmount disk3)
{13} andre@idio [~] % hdiutil eject /dev/disk2 "disk2" unmounted. "disk2" ejected.
(re-insert)
{15} andre@idio [~] % rwmount Warrior "disk2s1s3" unmounted successfully. /dev/disk3 /Volumes/DiskWarriorCD /Volumes/DiskWarriorCD: Indexing enabled for volume. /Volumes/DiskWarriorCD: Status: Indexing Enabled {16} andre@idio [~] % mdfind marmot /Volumes/DiskWarriorCD/motd.txt
fun :)
Pingback: Indexing shadow volumes with Spotlight | keyongtech