IN THIS ARTICLE
Outlines the behavior of Mac OS X’s Spotlight file search technology
- Behavior with external file servers
- Difference in behavior from the Spotlight Indexing of local physical volumes
- Updated fix for OSX 10.12 Sierra
REQUIREMENTS
- Cluster running Qumulo Core
- Mac OS X
DETAILS
Terminology
- Local Volume refers to a volume that is physically connected to the Mac, i.e a boot drive or a USB hard drive
- Remote Volume refers to a volume that is connected to the Mac via a network file sharing protocol such as NFS or SMB, i.e a Qumulo file share
Processes
Spotlight utilizes a number of system processes to index volumes and retrieve indexed information during a user driven Spotlight search.
mds - The MetaData Server process owned by root which is the parent of all other Spotlight processes
mds_stores - The process owned by root that monitors and retrieves information from Spotlight indexes
mdworker - The processes owned by the currently logged in user that perform the indexing of file volumes.
- Note that multiple mdworkers can be running concurrently
Locations
Spotlight stores volume index information in 2 different locations:
- For Local Volumes, the index is stored at the root directory of each indexed volume in a .Spotlight-V100 file. This file is owned by root and is accessible by all Mac user accounts via the the mds and mds_stores processes.
- For Remote Volumes, the index files are stored in /private/var/db/Spotlight-V100/Volumes/ directory in the following format:
protocol//user@server_adress/sharepoint
- Example:
#ls -la /private/var/db/Spotlight-V100/Volumes/
drwx------ 5 root wheel 170 Oct 28 17:17 smb:%2F%2Fjoe@gravytrain%2FFiles
drwx------ 5 root wheel 170 Oct 28 17:17 nfs:%2F%2F192.168.1.2%2NFS
Remote Volume Index File Facts
- Index files for Remote Volumes are accessible and shared by all users of a Mac system.
- Once a volume is indexed, all users on this Mac will have access to fast Spotlight-driven searches of this volume.
- Index files are unique to each server login account used to mount an external file server
- For example: Logging into the server “Qumulo” with the account “Admin” generates a separate index file than when logging into the same server with the account “Joe”
- If you do not access your external file servers via Domain Name, a new index file will be generated for each IP that you use to connect to the server
- The index file generated for a separate user login or server IP as described above will not be used to provide search results even if you are connected to the same server but under a different IP or user account
Differences between Remote Volume and Local Volume indexing
Spotlight will not perform a search of Remote Volume indexes when Spotlight is invoked via cmd + spacebar or via the Spotlight top right corner magnifying glass search box.
- Spotlight will only return search results from Remote Volume indexes when using the search box in a Finder window and specifying the Remote Volume as the search location
In the example below, Finder is performing a search for “test” in an SMB volume named “Files.”
Verify that Spotlight is indexing your Qumulo file share
You can check the index status of a volume with the following command:
sudo mdutil -s /Volumes/volume_name
Output of the command:
/Volumes/volume_name:
Indexing enabled.
Enable Spotlight indexing on a volume
sudo mdutil -i on /Volume/volume_name
Output of the command:
/Volumes/volume_name:
Indexing enabled.
Disable indexing of a volume
sudo mdutil -i off /Volumes/volume_name
Output of the command:
/Volumes/volume_name:
Indexing disabled.
Spotlight behavior with Remote Volumes can often be erratic and difficult to predict. In many instances, Spotlight's automatic indexing of Remote Volumes begins as soon as the volume is first mounted and other times Spotlight will completely ignore those volumes.
Sometimes you might receive end user complaints that Spotlight has gone “stale” and that the search index is not being updated. If this behavior persists after checking that the particular volume in question has its index status set to “Indexing enabled,” it may be necessary to force a re-index of the volume.
Delete an index file and force a re-indexing of a volume
sudo mdutil -E -i off /Volumes/volume_name && sudo mdutil -i on /Volumes/volume_name
Spotlight Indexing and IOPS Usage
Spotlight indexing can generate a considerable amount of IOPS activity against a file server with usage in the range of 200-300 IOPS per client being common during the early stages of the indexing process. Keep this in mind when enabling Spotlight indexing for a large number of Mac OS X Qumulo clients.
Spotlight Indexing and local disk use
A Spotlight index file can easily grow to 1GB + in size for each index file for a large Remote Volume. This is worth keeping in mind on systems with many user and remote file server accounts.
Keep an eye on what Spotlight is up to
The following Bash one-liner (run as root or sudo) can show you the current activity of all mdworker processes in a system. This is particularly useful during the early stages of a volume indexing process:
sudo pgrep mdworker | xargs -I % -n1 sudo lsof -p % | grep /Volumes | awk '{print $1," ",$3," ",$9}'
Verify that a Remote Volume is being indexed
Check for the presence of the proper index file for the desired protocol//user/server_address index file in /private/var/db/Spotlight-V100/Volumes:
ls -l /private/var/db/Spotlight-V100/Volumes/
Output of the command:
bash-3.2# ls -l /private/var/db/Spotlight-V100/Volumes/
total 0
drwx------ 5 root wheel 170 Dec 21 11:58 smb:%2F%2FQUMULO;admin@music%2Fspotlight
drwx------ 5 root wheel 170 Oct 28 17:17 smb:%2F%2Fadmin@cu1-10g%2Fmusic
drwx------ 5 root wheel 170 Dec 17 15:20 smb:%2F%2Fadmin@music%2Fspotlight
drwx------ 5 root wheel 170 Dec 21 15:57 smb:%2F%2Fadmin@music%2Fspotlight2
drwx------ 5 root wheel 170 Dec 17 14:39 smb:%2F%2Fjoe@gravytrain%2FFiles
If the index file for a Remote Volume does not appear in the listing, check the indexing status with mdutil as described above and re-index with the -E option if needed.
FIX FOR OSX 10.12 SIERRA
OS X 10.12 Sierra exhibits different behavior than previous OS X versions and does not index external volumes even after following all the above steps with mdutil -s always reporting "Indexing Disabled."
To fix this issue, create the following directory as root:
sudo mkdir -p /private/var/db/Spotlight-V100/Volumes/
And then re-enable Spotlight indexing of that Volume:
sudo mdutil -i on /Volumes/name_of_your_volume
RESOLUTION
You should now be able to successfully understand and utilize Spotlight Search with Qumulo
ADDITIONAL RESOURCES
QQ CLI: Comprehensive List of Commands
Like what you see? Share this article with your network!
Comments
3 comments