Understanding Mac OS X indexing using “mdutil -E -i off /”

3

1

Two questions about mdutil and indexing:

  • What is the -E option? It seems to me that it means something like "reindex" however the following bash command does not make sense to me mdutil -E -i off /.
  • Can you run mdutil on some arbitrary folder in your system and it will index recursively all subfolders, and nothing else on your system?

I have the general idea on mdutil but I'm just a little confused by the man mdutil explanation of -E.

user2522073

Posted 2015-09-03T23:32:25.333

Reputation: 33

Answers

5

As the man page for mdutil states; bold emphasis is mine:

The mdutil command is useful for managing the metadata stores for mounted volumes.

So when you ask:

Can you run mdutil on some arbitrary folder in your system and it will index recursively all subfolders, and nothing else on your system?

Nope since mdutil is not a folder-based metadata storage tool, but rather a volume-based metadata storage tool.

Then you say:

What is the -E option? It seems to me that it means something like "reindex" however the following bash command does not make sense to me mdutil -E -i off /.

The -E option in the man page is described as:

This flag will cause each local store for the volumes indicated to be erased. The stores will be rebuilt if appropriate.

So the -E option simply erases a metadata store on a specified volume. And in the case of this example:

mdutil -E -i off /

That command will erase (via the -E option) the metadata store on the volume mounted at root (/) and then set then turn off the indexing status (via the -i off option) on the volume mounted at root (/) as well.

Your confusion might come from the fact that / doesn’t seem like an explicit volume name but rather a path. But that / does indicate the root volume of the booted OS you are running that command on.

For example, let’s look at the output for ls -la /Volumes/ on an example Mac OS X system. It might look something like this:

drwxrwxrwt@  7 root  admin   238 Sep  3 19:48 .
drwxr-xr-x  29 root  wheel  1054 Sep  3 01:40 ..
-rw-r--r--@  1 jack  admin  6148 May 18 18:57 .DS_Store
lrwxr-xr-x   1 root  admin     1 Sep  3 10:17 Hard Drive -> /

Note how Hard Drive is not actually a “real” mounted volume as much as it is a symbolic link to the / mounted volume on the file system. The true mounted volume name is /.

So knowing that / and Hard Drive both point to the same mounted volume this command using the full /Volumes/ name:

mdutil -E -i off /Volumes/Hard\ Drive/

Is effectively the same command as this on the same Mac OS X system:

mdutil -E -i off /

JakeGould

Posted 2015-09-03T23:32:25.333

Reputation: 38 217

1Thank you. You are right part of my confusion is muddling the idea of paths, mounted volumes, and the "Hard Drive". And its obvious that E eases the metadata... Idk why I was confused XD. – user2522073 – 2015-09-04T00:31:49.237

@user2522073 It’s fair enough you were confused since Linux/Unix filesystems can be so simple they are daunting to new users. Live and learn! – JakeGould – 2015-09-04T02:06:20.363