1. Jul 28th, 2009

    OS X WTF: the Trash Wormhole 

    The OS X Trash Wormhole

    I’m trying to move files between two computers using a USB key. One is an old cranky computer that doesn’t feel like going online, so I have to shuttle everything the hard way. First batch goes fine. I copy files to USB, carry over to the Mac, copy over from USB, delete all the files on the USB.

    That’s when I discover the OS X Trash Wormhole.

    The volume is entirely empty. No files. Zero directories. Bare. Yet, magically this 1GB USB key has shrunk to just under 64MB of space. I’m sure quantum theory could account for zero files taking up over 900MB of space.

    Turns out that, like Schrödinger’s cat, these files are both there and not. They’re not there when you look at them, which is why you might think this is just a 64MB vintage USB key. Yet, if you use the Terminal, you will find they’re all quite there, collected in a directory called .Trashes. And .Trashes is plural, remember that.

    How do you get rid of files you can’t see? Hmm …

    OS X lets you empty the Trash from the Dock or a keyboard shortcut. Trash is singular. As you would expect, emptying the Trash will delete all your .Trashes, making room on the USB key (good), but also deleting all the trashed filed on the HD, some which may be accidentally trashed files (bad).

    While the file system maintains one trash on each volume, the UI only provides access to one global trash. Whoever (obviously didn’t) think of this design is a genius, though the award goes to whoever got the pluralization crossed.

    What I ended doing was to open Disk Utility and erase the USB key, thereby removing all the cruft OS X stores on the key without losing any of my HD trashed files. Then again, I’m a long time Linux user, I’m experienced in using low-level tools to work around flawed UI decisions. Still, I’m puzzled something like this could last through so many iterations of OS X.

    1. Jul 28th, 2009

      Garrett Albright

      This behavior predates OS X, actually. (Pre-OS X, disks used to have their own desktop directory, too, so mounting a disk could add files to the desktop. This feature wasn’t missed by anyone I know when OS X came around and did away with it.)

      I’m a bit confused by what you expected to happen. Clearly you didn’t “delete” the files on your USB drive; you just moved them into the Trash. You then have to empty the Trash in order to actually delete the files, just as with files on the Mac’s hard drive. Why would it be acceptable for this behavior to differ between fixed and removable drives?

      And if you’re accidentally trashing files, that’s another, completely unrelated problem. Either way, nothing’s stopping you from investigating the Trash contents before emptying it.

      And if you’re really an experienced Linux user, one would hope you would have thought to try `rm -r /Volumes/[USB drive name]/*` before you went through the bother of reformatting the thing. =/

    2. Jul 28th, 2009

      Jack Dempsey

      Assaf,

      While I agree this is amusing at the best of times and “…w…t…f…” at others, I think I’m confused–why not just remove the files from your Trash, empty it, then put them back int? Somehow I guess I’m confusing things. Glad you got a solution that worked.

      Jack

    3. Jul 28th, 2009

      Assaf

      I Cmd-Deleted the files from the USB key, I did not move them to the Trash. OS X did that without asking my permission or offering me an alternative. On Windows/Linux I could Shift-Delete files I don’t want to see anymore.

      If the UI exposed two trashes, one for HD and one for USB key, I would just empty one trash and leave the other one untouched. (I have room to spare on the HD, would rather keep those files in case I accidentally deleted a file I need)

      If the FS had one trash, obviously on the HD, then it would move all the trashed files there and the USB key would have ample room for new files.

      In either of these cases, the UI and FS operate on the same abstraction of storage. As it stands, the UI exposes one abstraction (unified Trash) while the FS implements a conflicting abstraction (multiple Trasheses). That’s a WTF.

      BTW I tried both, turns out Disk Utility is slightly quicker to use them rm, and always gets rid of everything, so that’s the solution I ended up with.

    4. Jul 28th, 2009

      Garrett Albright

      Command-Delete moves files to the Trash. Check out the Finder’s “File” menu.

      If the UI exposed a Trash for every disk, it would, well, expose a Trash for every disk. Now you’re an amateur computer user with a hard drive, a DVD-ROM and a USB drive mounted, and you want to delete a file. You look in your Dock and see three identical-looking Trash icons. Which one do you drag your file to? Or you’ve moved it to the Trash previously, but now you want it back. Which Trash icon do you look in?

      And do you really want to wait for files to be moved off of the USB disk to your hard drive when what you really want to do is delete them? That will take longer than just deleting them, because you’re actually shifting the file bits around instead of just marking them overwritable as you do when you “delete” something in the Finder.

      I don’t think it’s necessarily your fault that you feel frustrated that the Finder didn’t behave as you were expecting. But they’re standards that have been in place for decades, and the alternatives you’re proposing aren’t practical in my opinion. Sorry.

      (I thought there was a key command to delete files instantly from the Finder, without running them through the Trash first, but I can’t (re-)find it. Was it just my imagination?)

    5. Jul 28th, 2009

      Assaf

      If the UI was properly designed than it would expose a trash for every disk, because, in fact every disk has a trash.

      When I open the options menu of a volume to eject it, rename it, get info, etc, it could offer me the option to empty its trash. Simple, elegant and consistent with the Mac HCI. The dock icon — and you only need one icon to drag files into, because it’s a virtual sink — could offer an option to empty all trashes or individual when you click & hold.

      That way I would a) be aware that there’s a space-wasting trash on my USB key, and b) easily and quickly empty it, without downside on the rest of the UI.

      If it was even smarter it could automatically make room when I move files in by removing old files from the trash, just like caches and garbage collectors work. Then I would never have to empty the trash. Who wants to empty it anyway?

      Or it could have an option to automatically empty the trash when I eject the drive, just like email app has an option to automatically empty trash when you exit. That’s a known metaphor.

      There is no shortcut to directly delete files without sending them to Trash on OS X. There’s one on Windows, KDE and GNome.

    6. Jul 29th, 2009

      Garrett Albright

      “If it was even smarter it could automatically make room when I move files in by removing old files from the trash, just like caches and garbage collectors work.”

      Just like caches and garbage collectors work, but NOT like how the Mac OS trash has worked since its very conception, man. Or any of its knock-offs. You’re not only reinventing wheels, your new wheels are triangular.

      Maybe you should stick with Linux, where interface consistency is an afterthought…

    7. Jul 29th, 2009

      Sander Temme

      The Trash is not a place to keep files. If you have files you don’t want to lose when you empty the Trash, move them out of the Trash first.

      Also, rm works the way you expect it to: it immediately deletes the bits from disk.

    8. Jul 30th, 2009

      Brummer

      Apple, please never hire mr. Assaf for your UI team!!

    9. Aug 2nd, 2009

      bornonjuly4

      ok, I got bit by the same problem – My USB got filled up and removing files from it doesn’t seem to reclaim the space. I had to follow the same disk utility method to clean up the drive.

      Now for an average user, who doesn’t know terminal and doesn’t understand the concept of multiple trashes, how do you explain them to reclaim the lost space in the USB? Does Apple want to google for an answer?

      Don’t tell me to do an rm -rf to remove the files. I know how it works, and I don’t want to deal with command line BS when OSX claims to be the pinnacle of UI Nirvana.

      Also what is up with the files taking forever to delete? (I am not talking secure trash). Why on earth is it counting all the files before deleting the damn thing? I want to get rid of my trash, so delete it right away! Just because I have 10GB in my trash doesn’t mean it should take 10 mins to delete it!

    10. Aug 4th, 2009

      Alex

      Hi everyone!

      I got the same problem several times while moving files between MAC and Windows computers. So I decided we have to make simple software application to help users like me and you.

      Please check it out at:
      http://www.affinity-tools.com/usbfresher/

      that is absolutely free for everyone. Hope you’ll like it :)

      PS. Comments and suggestions are welcome. The only thing I would ask if you really like it, please send us your “success story”. Thanks.

    11. Aug 5th, 2009

      Juri Pakaste

      Yeah, I’ve been bit by this multiple times, too. Now that I use mainly Macs I’ve grown used to it, but I still think the behaviour of the Trash UI leaves a lot to be desired in this regard.

    12. Dec 21st, 2009

      praxis22

      I think you could equally label this article OSX trash wtf! Since it does this on other writable disks too, not just USB.

      I spent a while searching google, and run across many of these threads, wherein somebody who has seen how the outside world does it, has the temerity to question the fact that the delete key only works within programs, not on them. This is always met with people telling you to do it “how you’re supposed to” Which in this instance is how Apple has said you should. Primarily I suspect to avoid helpdesk calls. In many ways it’s a lot like Gnome. Who insist they know better than their users how they wish to use their operating systems.

      After you dig for a while, you come across fascinating discussions about the trash not working, or exhibiting strange behaviours, such as actually deleting things without holding your hand. This gives me hope, as it means that the OS will do what I want it to, even if not by design. In these more technical discussions, about the underpinnings of the OS as opposed to the user interface design, many people recommend using the UNIX rm command. This will work, but it’s a sledgehammer to crack a walnut. It’s also stepping well outside of your comfort zone if you like how Apple does it, and you fear losing data. With rm there is no undo, it’s for people who know what they’re doing and don’t fear the consequences.

      Actually to digress for a moment one of the truly fascinating & alien things about OSX is the way it integrates the desktop/UI into the OS proper. I actually had to buy a book, this one: http://oreilly.com/catalog/9780596003562 so I could understand what was going on. Because nobody, not even the Geniuses (I always thought that was ironic :) could tell me what I wanted to know. Even then I had to spend an hour or more with “OSX Internals” before I fully understood the model. The whole XML thing completely threw me at first. Being a UNIX admin I’m used to the fact that everything, even the hardware, is a file. I just didn’t appreciate how far the OSX application model would push it. Programs are not (monolithic) programs, they are collections of files. Unlike UNIX/Linux where it is possible to launch a windows application from the command line, it’s all but impossible to do this in OSX unless you read and understand the XML first. The separation between church and state is so complete it’s maddening. But I digress :)

      So anyway, thanks for a fascinating discussion, once I find out how to “fix it” In the spirit of OSX86 hackers everywhere, I’ll be sure to let you know :)

    Your comment, here ⇓