New 2013 iMac spotlight issue (mavericks)

Discussion in 'iMac' started by Nirurin, Oct 31, 2013.

  1. Nirurin, Oct 31, 2013
    Last edited: Oct 31, 2013

    Nirurin macrumors member

    Joined:
    Oct 3, 2013
    #1
    I am posting this here because I am not sure if this is a device-specific issue, or if it is a software issue, and i wanted to se if anyone else is having this problem.

    I have the new 2013 iMac, with a 256gb SSD. For bulk storage, I have been using a 3tb external USB3 hard drive. This drive seems to be working perfectly.

    The problem, is with spotlight.

    Every night now, after midnight, is when I have been noticing it. I will hear the drive chugging along like its working on something, even though I am not actively reading anything from the drive. When I click on the spotlight icon, I see a striped bar and "Estimating indexing time", which never goes away and never stops estimating.

    I first noticed this a few days ago, and (after much research) found the following fix:
    http://apple.stackexchange.com/questions/1072/spotlight-indexing-appears-stuck-what-can-i-do

    The fix is the top result with 14 rate ups, where you turn off indexing, delete the index from the external drive, and restart indexing.

    This worked, after about 30 seconds of indexing the drive was fully indexed, and I could search for any file as I should.
    Also, the next day when I turn the computer back on again, the spotlight index still worked fine, I could still search for anything.

    HOWEVER:
    Again, late in the evening, I notice the drive working hard. WHen I check spotlight, it is again "Estimating index time" and the searches for files that worked earlier in the day no longer appear in the search.

    The only fix, is to re-do the steps in the guide I linked, but I would rather not do this on a daily basis...

    It would seem as if the spotlight index on the external drive is becoming corrupted on a daily basis... but not upon a restart, it seems more time-related.... its wierd.

    So, does anyone know of any solutions to this? Long term ones I mean.

    Thanks!

    Edit:
    I can of course fix it by adding the external drive to the 'privacy' tab of spotlight, so that it does not get indexed... however I don't really see this as a viable solution.
     
  2. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    To save yourself the trouble from typing in those commands every day you can put them into a shell script or Applescript. Or use Automator to automate this task and use the new Display Notification Action to provide some feedback. There's even a new Speakable-Workflows feature in Automator in Mavericks that enables you to save your applets as Speakable items so you can say something like Disable Indexing On My Drive for example. Not a long term solution but check it out.

    Info : Speakable-Workflows
     
  3. aznboi91 macrumors regular

    Joined:
    Jul 27, 2012
    #3
    You can make a cron job off the shell script too ...

    or you can just reinstall mavericks
     
  4. Nirurin thread starter macrumors member

    Joined:
    Oct 3, 2013
    #4

    Is re-installing mavericks likely to fix the problem?

    Otherwise I may just do the script thing, but it seems like a fault that apple should fix rather than something I need to work around.
     
  5. Poncho macrumors 6502

    Poncho

    Joined:
    Jun 15, 2007
    Location:
    Holland
  6. Nirurin thread starter macrumors member

    Joined:
    Oct 3, 2013
    #6

    I'm trying the delete that is done in that guide, though it is not too much different from what I have tried before... It is causing a proper reindexing so it may fix the problem this time. I'll keep an eye on it for a day or so and see what happens.

    If this one fails, I may try reinstalling mavericks again, though I'm not to sure that this will help, as I installed mavericks originally on a totally new system so it should be the best install I can get really.
     
  7. aznboi91 macrumors regular

    Joined:
    Jul 27, 2012
    #7
    I think clean installs are always better than trying to figure out what the issue is... its expensive but i think it gets the job done pretty well every time... no need to spend hours ... spend those hours somewhere else like outside :)
     
  8. Nirurin thread starter macrumors member

    Joined:
    Oct 3, 2013
    #8

    Why expensive? Mavericks was free...
     
  9. aznboi91 macrumors regular

    Joined:
    Jul 27, 2012
    #9
    I think time is quite expensive and costly....
     
  10. Nirurin thread starter macrumors member

    Joined:
    Oct 3, 2013
    #10
    Ahh I see!

    Well everything continued to work for a few days as normal... but then tonight it suddenly tried indexing again, and was stuck on estimating. No reason behind it, that I can see.

    I am going to attempt to reinstall mavericks, but in case this doesnt fix it, could anyone on here help me with Applescript? I have not used it before, and I can't really see how I can get it to do what I want it to do...

    The following are the terminal lines I need it to have in the script:

    sudo mdutil -i off /Volumes/B-Storage
    **This then asks for a password, so I would either need a way around this, or a line here to auto-input my password**

    sudo mdutil -E /Volumes/B-Storage
    cd /Volumes/B-Storage
    sudo rm -fr .Spotlight-V100
    sudo mdutil -i on /Volumes/B-Storage


    So its 5 lines. I would set automator to run the script once a day when I log in... or maybe just run it manually when i notice the spotlight playing up. If anyone could help me with the applescript for this I'd be very grateful :)
     
  11. kryten2, Nov 4, 2013
    Last edited: Nov 5, 2013

    kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #11
    Try this :

    Code:
    -- this will prompt for your password
    
    do shell script "VOLUMENAME=/Volumes/B-Storage; mdutil -i off $VOLUMENAME && mdutil -E $VOLUMENAME && rm -fr $VOLUMENAME/.Spotlight-V100 && mdutil -i on $VOLUMENAME" with administrator privileges
    
    -- or alternatively you can use user name "yourusernamehere" ¬
    -- password "yourpasswordhere" with administrator privileges to avoid prompting ¬
    -- for your password
    
    (*
    do shell script "VOLUMENAME=/Volumes/B-Storage; mdutil -i off $VOLUMENAME && mdutil -E $VOLUMENAME && rm -fr $VOLUMENAME/.Spotlight-V100 && mdutil -i on $VOLUMENAME" user name "yourusernamehere" password "yourpasswordhere" with administrator privileges
    *)
    
     

    Attached Files:

  12. Nirurin thread starter macrumors member

    Joined:
    Oct 3, 2013
    #12

    Thanks Kryten!
    I have done a reinstall of mavericks, but if it doesnt fix the issue I'll try this out and let you know :)
     
  13. Nirurin thread starter macrumors member

    Joined:
    Oct 3, 2013
    #13

    OK unfortunately this comes up with the following error:

    error "/bin/sh: -c: line 1: syntax error near unexpected token `&&'
    /bin/sh: -c: line 1: `&& mdutil -E $VOLUMENAME && rm -fr $VOLUMENAME/.Spotlight-V100 && ¬'" number 2
     
  14. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #14
    Oops sorry. Try this :

    Code:
    -- this will prompt for your password
    
    do shell script "VOLUMENAME=/Volumes/B-Storage; mdutil -i off $VOLUMENAME && mdutil -E $VOLUMENAME && rm -fr $VOLUMENAME/.Spotlight-V100 && mdutil -i on $VOLUMENAME" with administrator privileges
    
    -- or alternatively you can use user name "yourusernamehere" ¬
    -- password "yourpasswordhere" with administrator privileges to avoid prompting ¬
    -- for your password
    
    (*
    do shell script "VOLUMENAME=/Volumes/B-Storage; mdutil -i off $VOLUMENAME && mdutil -E $VOLUMENAME && rm -fr $VOLUMENAME/.Spotlight-V100 && mdutil -i on $VOLUMENAME" user name "yourusernamehere" password "yourpasswordhere" with administrator privileges
    *)
     
  15. Nirurin thread starter macrumors member

    Joined:
    Oct 3, 2013
    #15

    Thanks Krytey :) I'll try it next time it goes wrong
     
  16. Nirurin thread starter macrumors member

    Joined:
    Oct 3, 2013
    #16
    ok well after a couple of days of normal behavious, the spotlight index went wrong again.

    I ran the script... and nothing seemed to happen. In the description log box below it says:

    "/Volumes/B-Storage:
    Indexing disabled.
    /Volumes/B-Storage:
    Indexing enabled. "


    Which is fine, but the spotlight continues to "estimate indexing". Its as if the applescript isnt doing the part whenre it is supposed to delete the spotlight index files.

    Doing the stages manually works, but auto-scripting isnt, for some reason
     
  17. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #17
    Works for me. Do you mean you don't see any output of the rm command?
    Try this :

    Code:
    -- this will prompt for your password
    
    do shell script "VOLUMENAME=/Volumes/B-Storage; mdutil -i off $VOLUMENAME && mdutil -E $VOLUMENAME && echo Files and directories removed by rm : && rm -vfr $VOLUMENAME/.Spotlight-V100 && echo --- End of rm section --- && mdutil -i on $VOLUMENAME" with administrator privileges
    
    -- or alternatively you can use user name "yourusernamehere" ¬
    -- password "yourpasswordhere" with administrator privileges to avoid prompting ¬
    -- for your password
    
    (*
    do shell script "VOLUMENAME=/Volumes/B-Storage; mdutil -i off $VOLUMENAME && mdutil -E $VOLUMENAME && rm -fr $VOLUMENAME/.Spotlight-V100 && mdutil -i on $VOLUMENAME" user name "yourusernamehere" password "yourpasswordhere" with administrator privileges
    *)
     

    Attached Files:

  18. Nirurin thread starter macrumors member

    Joined:
    Oct 3, 2013
    #18



    Ahha well, that did seem to work properly, would there be any chance you could make that echo change for the one that doesnt require me to enter my password each time?

    Really grateful for your help, hopefully I can get this down so I dont have to keep messing around with it... such a stupid and needless flaw in the OS
     
  19. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #19

    If I understand your question correctly you don't want to enter your password each time the script runs right? The answer to that is in the script. Replace this :

    Code:
    with administrator privileges
    with this :

    Code:
    user name "yourusernamehere" password "yourpasswordhere" with administrator privileges
    and change yourusernamehere and yourpasswordhere with the appropriate account values. Values must be entered between the quotes!

    Example with pseudo values :

    Code:
    user name "bob" password "password" with administrator privileges 
     
  20. aggri1 macrumors 6502

    Joined:
    Jul 21, 2010
    #20
    I'm seeing what seems to be similar Spotlight stupidity on a 2011 MacBook Pro: stuck on "Estimating indexing time" (external USB HD) for long periods of time, during which the system is extremely unresponsive.

    I don't consider rebuilding the index every few days a decent solution, so I hope the 10.9.1 update addresses the issue - as well as Mavericks' general unresponsiveness.

    Cheers.
     

Share This Page