How to prevent USB from .fseventsd, .Trashes, .Spotlight-V100 folders and .DS_Store files?

26

8

If you give somebody your USB drive to put files on it, it is so annoying to clean up afterwards, all these useless for other than OSX platforms artifacts, which pollute the disk. Is it any solution to prevent this behavior. Maybe to write those files on your own and set them as read only something like "6/700" permissions?

P.S. I'm not asking what to do on OSX by others, since I don't know who will put me a new file next time (I can't explain this problem and any configurations to all other people), but rather what to do from the USB drive point of view.

static

Posted 2014-07-30T23:02:28.917

Reputation: 1 087

Answers

21

If you're going to share an writable, external disk with other OS X systems, you can run the following command from YOUR machine to prevent .DS_Store files from appearing

touch /Volumes/your_volume_name/.metadata_never_index

then protect the file by running

chmod 444 /Volumes/your_volume_name/.metadata_never_index

This existence of this hidden file will prevent OS X Spotlight from indexing the drive so you only need to do it once unless you reformat the drive. I don't know if this works cross-platform, e.g., the dreaded thumbs.db Windows files.

Hope this helps.

SaxDaddy

Posted 2014-07-30T23:02:28.917

Reputation: 3 181

11So to prevent it writing hidden files to the usb you have to create a hidden file? Sigh – Basic – 2014-11-19T09:23:11.083

What benefit is chmod 444? It may prevent writes to it, but it won't prevent its deletion, and you probably don't care about its contents. Whether Unix permissions will work on the USB stick's file system is also up for debate. – mwfearnley – 2019-10-03T08:02:58.847

10

I found this blog post very useful: http://blog.hostilefork.com/trashes-fseventsd-and-spotlight-v100/

basically:

To stop OS/X from doing Spotlight indexing, you need a file called .metadata_never_index in the root directory of the removable drive. To stop OS/X from making a .Trashes directory, you need to make your own file that isn't a directory and call it .Trashes To keep it from doing logging of filesystem events on the drive, you need to make a directory called .fseventsd and inside that folder put a single file named no_log. ... I don't know of any way to prevent OS/X from creating .DS_Store files, which track some preferences in each directory...

But read the blog for full information and details.

akostadinov

Posted 2014-07-30T23:02:28.917

Reputation: 1 140