This article has been archived and is no longer updated by Apple.

Xsan 3: Invisible "__defragtmp" files are created after using snfsdefrag

When defragmenting a file with snfsdefrag on systems running OS X Mountain Lion v10.8.4 and earlier, an invisible "__defragtmp" file may be created which cannot be deleted.

This issue may occur when the following are true:

  • The defragmented file's name contains precomposed Unicode characters, such as letters with diacritical marks (an accent, grave, or umlaut).

  • snfsdefrag is run by root.

  • snfsdefrag is run when the current working directory is on an Xsan volume, or snfsdefrag's recursive option (-r) is used.

Update all Xsan systems to OS X Mountain Lion v10.8.5 or later before running snfsdefrag.

For systems running older versions of OS X, workaround the issue by changing directories to a path that is not on an Xsan volume (such as the root directory) before running snfsdefrag, and avoid using snfsdefrag's recursive option (-r).

If you need to recursively defragment files in a directory on an Xsan volume, you can do so by running snfsdefrag from the find utility. For example:

cd / sudo find /Volumes/MyVolume/some_directory -type f -exec snfsdefrag '{}' \;

Alternatively, you can use snfsdefrag normally as the file's owner.

Learn more

Despite the alert messages, snfsdefrag does successfully defragment the file.

snfsdefrag will show output similar to this:

$ sudo snfsdefrag -m0 -r -v /Volumes/MyVolume/defrag_test /Volumes/MyVolume/defrag_test/héllo.txt: 1 extent: can't bulk create temp file "/Volumes/MyVolume/defrag_test/héllo.txt__defragtmp", File exists new extent count 1, done. Can't stat '/Volumes/MyVolume/defrag_test/héllo.txt__defragtmp' - No such file or directory

After defragmenting a file, when using ls to list files in the directory, you may see results similar to this:

ls: héllo.txt__defragtmp: No such file or directory

The invisible "__defragtmp" files left behind do not contain any data and can be safely ignored. The same "No such file or directory" message will appear if you attempt to delete the "__defragtmp" file with the rm command.

Published Date: