MacOS – How to isolate processes that evoke insane mds_stores disk read activity

command linemacosmdsspotlightterminal

I have an interesting situation where when I monitor my disk activity, I find that mds_store is continually running between 1 to 35 megabytes per second (averaging around 3-5 MB/s) on the read and write is not nearly as active.

When I start poking a bit, I find that sudo fs_usage -w -f filesys mds_stores yields entries such as this pouring out:

13:21:23.464493    THROTTLED                           0.016529 W mds_stores.4317356
13:21:23.489648    THROTTLED                           0.018385 W mds_stores.4317356
13:21:23.489654  PAGE_IN_FILE      A=0x03d3684000      0.025133 W mds_stores.4317356
13:21:23.493568  fstat64           F=14                0.000004   mds_stores.7483264
13:21:23.493591  open              F=76       (R_____)  .      0.000022   mds_stores.7483264
13:21:23.493593  pthread_fchdir    F=14                0.000002   mds_stores.7483264
13:21:23.493595  pthread_fchdir    F=76                0.000001   mds_stores.7483264
13:21:23.493599  close             F=76                0.000004   mds_stores.7483264
13:21:23.514793    THROTTLED                           0.016235 W mds_stores.4317356
13:21:23.514795  PAGE_IN_FILE      A=0x03bcfa3000      0.025115 W mds_stores.4317356
13:21:23.514816  PAGE_IN_FILE      A=0x0126a73000      0.000009   mds_stores.4317356
13:21:23.514829  PAGE_IN_FILE      A=0x0359a68000      0.000006   mds_stores.4317356
13:21:23.514835  PAGE_IN_FILE      A=0x0359a69000      0.000002   mds_stores.4317356
13:21:23.514839  PAGE_IN_FILE      A=0x0353065000      0.000003   mds_stores.4317356
13:21:23.514849  PAGE_IN_FILE      A=0x02ae755000      0.000004   mds_stores.4317356
13:21:23.514875  PAGE_IN_FILE      A=0x0352ea3000      0.000003   mds_stores.4317356
13:21:23.540844    THROTTLED                           0.015997 W mds_stores.4317356
13:21:23.540845  PAGE_IN_FILE      A=0x0627001000      0.025959 W mds_stores.4317356
13:21:23.566207    THROTTLED                           0.016132 W mds_stores.4317356
13:21:23.566208  PAGE_IN_FILE      A=0x06120f8000      0.025346 W mds_stores.4317356
13:21:23.591700    THROTTLED                           0.024999 W mds_stores.4317356
13:21:23.591701  PAGE_IN_FILE      A=0x05c61cc000      0.025477 W mds_stores.4317356
13:21:23.591717  PAGE_IN_FILE      A=0x03ceaa6000      0.000007   mds_stores.4317356
13:21:23.617039    THROTTLED                           0.020100 W mds_stores.4317356
13:21:23.617041  PAGE_IN_FILE      A=0x035907b000      0.025312 W mds_stores.4317356
13:21:23.617066  PAGE_IN_FILE      A=0x0352739000      0.000015   mds_stores.4317356
13:21:23.617102  PAGE_IN_FILE      A=0x0359870000      0.000004   mds_stores.4317356
13:21:23.617106  PAGE_IN_FILE      A=0x0352e84000      0.000003   mds_stores.4317356
13:21:23.617125  PAGE_IN_FILE      A=0x03d36f2000      0.000005   mds_stores.4317356
13:21:23.617131  PAGE_IN_FILE      A=0x03bc7b7000      0.000003   mds_stores.4317356
13:21:23.617140  PAGE_IN_FILE      A=0x05db4ec000      0.000004   mds_stores.4317356
13:21:23.617147  PAGE_IN_FILE      A=0x05a8579000      0.000004   mds_stores.4317356
13:21:23.617153  PAGE_IN_FILE      A=0x05af581000      0.000003   mds_stores.4317356
13:21:23.617162  PAGE_IN_FILE      A=0x03d2470000      0.000003   mds_stores.4317356
13:21:23.617171  PAGE_IN_FILE      A=0x03bc86a000      0.000003   mds_stores.4317356
13:21:23.617184  PAGE_IN_FILE      A=0x02b5430000      0.000004   mds_stores.4317356
13:21:23.617188  PAGE_IN_FILE      A=0x02ae6ba000      0.000002   mds_stores.4317356
13:21:23.617208  PAGE_IN_FILE      A=0x05d2472000      0.000002   mds_stores.4317356
13:21:23.617211  PAGE_IN_FILE      A=0x05d23db000      0.000002   mds_stores.4317356
13:21:23.643334    THROTTLED                           0.015374 W mds_stores.4317356
13:21:23.643335  PAGE_IN_FILE      A=0x02b4f90000      0.026121 W mds_stores.4317356
13:21:23.643371  PAGE_IN_FILE      A=0x0126a74000      0.000010   mds_stores.4317356
13:21:23.643381  PAGE_IN_FILE      A=0x02ae4f3000      0.000006   mds_stores.4317356
13:21:23.643403  PAGE_IN_FILE      A=0x012660c000      0.000004   mds_stores.4317356
13:21:23.643413  PAGE_IN_FILE      A=0x03d1d24000      0.000005   mds_stores.4317356
13:21:23.643422  PAGE_IN_FILE      A=0x060e3f3000      0.000004   mds_stores.4317356

From sudo iosnoop I'm getting results such as:

  UID   PID D    BLOCK   SIZE       COMM PATHNAME
    0   267 R 751100301  73728 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/3.indexPositions
    0   267 R 690656474  49152 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/7.indexPositions
    0   267 R 690679661  61440 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/7.indexPositions
    0   267 R 690535202  16384 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/6.indexPositions
    0   267 R 674483853  65536 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/6.indexPositions
    0   267 R 751115784  53248 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/3.indexPositions
    0   267 R 674385243  32768 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/7.indexPositions
    0   267 R 690503775  49152 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/6.indexPositions
    0   267 R 690500420  53248 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/6.indexPositions
    0   267 R 674385343  53248 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/7.indexPositions
    0   267 R 784657427  77824 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/4.indexPositions
    0   267 R 673802683  49152 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/5.indexPositions
    0   267 R 784649988  77824 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/4.indexPositions
    0   267 R 673800704  36864 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/5.indexPositions
    0   267 R 690428039  57344 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/5.indexPositions
    0   267 R 673802586  24576 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/5.indexPositions
    0   267 R 690428087  32768 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/5.indexPositions
    0   267 R 784647796  73728 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/4.indexPositions
    0   267 R 690502092  65536 mds_stores ??/35CD368B-C966-4D1B-9E7E-82B08A1CF7B4/6.indexPositions

I'm very much curious as to how to track down what would be causing this kind of activity. I thought it might be a passing issue, but it has been ongoing for several hours now. Is there a way to get a close peek at what is evoking Spotlight activity such as this insomuch that I can isolate the process that is evoking this behavior?

I was hoping that I could leverage 4317356 since that number or ID appears consistently over this period of time, but it does not seem to relate to any PIDs or other identifiers that I've hunted for thus far.

Best Answer

mds_stores indicates, that your Spotlight is running wild. This is a known issue on OS X Mavericks and others.

There is an article by 9to5Mac How to: Get Spotlight processes back under control when CPU usage goes crazy which says that you should do the following.

  1. Turn Spotlight off with

    sudo mdutil -a -i off
    
  2. Delete the Spotlight index with

    sudo rm -rf /.Spotlight-V100/*
    
  3. Go to System Preferences/Spotlight/Privacy and disable all folders with often changing content by dragging them into privacy. (Backup, Dropbox and similar)

  4. Turn Spotlight on again with

    sudo mdutil -a -i on
    
  5. Inspect /System/Library/Spotlight/ for ‘Plug-ins’ which could cause some havok with often changing content. Put them into other location and start investigating with mdimport.

  6. Turn indexing of pure Backup-Volumes to off with

    sudo mdutil -i off /Mountpoint/Volumename
    
  7. Wait for OS X Update, reverse steps 1-6, check Activity Monitor, and hopefully don't have to do steps 1-6 again.