MacOS – Can’t empty trash of removable HD

external-diskmacostrash

I can't empty the trash of my removable drive. At first it appears to empty it correctly (no error message, the sound is played), but the folder in question stays there.

I tried:

jan@MacBook-Pro /Volumes/JD 2 $ sudo rm -rf .Trashes/

which gives errors like the following:

rm: .Trashes//501: Directory not empty
rm: .Trashes/: Directory not empty

Anyways, I narrowed it down to a .svn file that can't be deleted:

root@MacBook-Pro /Volumes/JD 2/.Trashes/501/CD_10.2009/devel/funghos $ ls -altr .svn
-rwxrwxrwx  1 _unknown  _unknown  690 Oct 21  2009 .svn
root@MacBook-Pro /Volumes/JD 2/.Trashes/501/CD_10.2009/devel/funghos $ rm -f .svn
root@MacBook-Pro /Volumes/JD 2/.Trashes/501/CD_10.2009/devel/funghos $ ls -altr .svn
-rwxrwxrwx  1 _unknown  _unknown  690 Oct 21  2009 .svn

As you can see, no error appears, but the file doesn't get deleted. Huh?

Best Answer

This is due to the MNT_IGNORE_OWNERSHIP flag being set for the drive when mounted. The unknown user and group are exactly what show up when root views files on a drive for which permissions are ignored. When a user views the permissions, the files will show up as their own. I'm surprised you can't delete the .svn file from your own account (not root)

Please see this Ask Different Answer for more direction. Basically, you'll need to uncheck the "Ignore ownership on this volume" checkbox from an inspector on the drive info.

If you can't delete it from your user account, try setting yourself as the file owner with the ignore flag unset.