くまきち

山と旅と家族が大事。
でも激しい物欲が理性と財布のタガを飛ばす
最近は自転車も乗ってる

[OSX][Spotlight]リムーバブルディスクのインデックス作成を止める

2014-03-12 23:32:53 | SEまわり
OSX を 10.9.2 に上げてから、外付け HDD を接続するといつもディスクアクセスが激しいのが気になってた。
調べたら Spotlight 用に検索インデックスを作っているとのこと。

外付け HDD は常用じゃなくて、写真データとかを持ち歩くためのストレージ用途だ。
インデックスがあってもいいけど、接続するたびに毎回再構成されるのは迷惑。

ということで止める方法。

mdutil コマンドを使う。root権限必要。

まずは使い方。--help を付けて呼んだらエラーと共に Usage が表示された。

~ $ mdutil --help
mdutil: unrecognized option `--help'
Usage: mdutil -pEsa -i (on|off) -d volume ...
mdutil -t {volume-path | deviceid} fileid
Utility to manage Spotlight indexes.
-p Publish metadata.
-i (on|off) Turn indexing on or off.
-d Disable Spotlight activity for volume (re-enable using -i on).
-E Erase and rebuild index.
-s Print indexing status.
-t Resolve files from file id with an optional volume path or device id.
-a Apply command to all volumes.
-V vol Apply command to all stores on the specified volume.
-v Display verbose information.
NOTE: Run as owner for network homes, otherwise run as root.

-i オプションを使えばオンオフ切替ができて、 -s を付けると状態表示らしい。

まずは状態確認。Volume名は Transcend。

~$ sudo mdutil -s /Volumes/Transcend
/Volumes/Transcend:
Indexing enabled.

有効にされてるね。
じゃあ、無効にしてあげる。

~ $ sudo mdutil -i off /Volumes/Transcend
/Volumes/Transcend:
Indexing disabled.

再確認。

~ $ sudo mdutil -s /Volumes/Transcend
/Volumes/Transcend:
Indexing disabled.

ディスクアクセスが静かになっていい感じ。