gvfsd-trash's way of clearing the trash

One of the way that make the laptop reach for its limits is when its clearing up the trash in a gnome based DE with nautilus based FM. With the trash has about a plethora of files (for example, a copy of the whole android open source project) clearing it up makes it very hot and stop before it can delete them.

Based on top, the process gvfsd-trash uses about 50% plus it will take a long time to do it. Clearing the directory ~/.local/share/Trashor any directory where the "trash files" go for a hope of a salvation from deletion with a rm -rf command do the task a whole lot faster than gvfsd-trash. What does gvfsd-trash do to do that compared to a simple rm -rf command?


Solution 1:

I have a hate-hate relationship with gvfsd-trash. I think can work well on a single PC but with a small office network it can become a bit of a nightmare. I suspect that when it empties the trash, it does the "tidying up" as it goes along. That can get complicated when mount points are moved or permissions & ownerships are changed. It also seems to tie up the CPU for long periods trying to work things out each time the machine starts.

My technique when gvfsd-trash starts slowing down the machines is to use:

$ sudo rm -rf ~/.local/share/Trash

This gets rid of the Trash on my own machine. The daemon also creates directories called ".Trash-1000" in the roots of the network mounts. Deleting them using

$ sudo rm -rf [..path to file..]/.Trash-1000

from the server where each network share resides cures a lot of performance problems. Here "1000" is my UID, yours may be different. "gvfsd-trash" seems to be quite good at getting rid of it's baggage once the Trash directories are gone.

NOTE: "This works on a Ubuntu / Mint system where "sudo" provides root privileges. With other distros use the appropriate technique. If the "rm" command works without root privileges all the better but the problem is usually at its worst when it can't.