Prevent MacOS X from writing dot-files to removable storage

From braindump
Jump to navigation Jump to search

If you use removable storage devices such as USB sticks and USB harddisks on more than just one operating system sooner or later you run across the dot-files written by MacOS X.

To the best of my knowledge there is no universal way preventing MacOS X writing to any removable device so the below has to be done to every device.

Mini Howto

Prevent Spotlight from indexing

The below command will prevent Spotlight from indexing for more information use man mdutil on a Mac.

sudo mdutil -i off /Volumes/<VolumeName>

Alternative way

Simply creating a file in the root of the device called .metadata_never_index should yield the same effect as the mdutil command above. Under MacOS the following command will do.

sudo touch /Volumes/<VolumeName>/.metadata_never_index

If the removable storage device is formatted with FAT or NTFS it makes sense to hide the file from the eyes of the casual user. Under Windows this will hide the file from view (depending on Explorer settings).

attrib +H +S <DriveLetter>:\.metadata_never_index

References