14

I have my files in a separate partition that is not mounted to /home, but only linked to it. How do I manage to be able to use the gnome trash in those files?

For example:

partion 2: mounted on /data, with a folder /data/myname

partion 1: mounted on /, with its own /home and /home/myname, inside it /home/myname/Desktop and /home/myname/Documents link to /data/myname/Desktop and /data/myname/Document respectively. Suppose I have a file /data/myname/Document/example.txt.

When I use nautilus, and try to delete /home/myname/Document/example.txt, Nautilus say it can't use the trash. It took me a while to figure out it is because example.txt is in a different filesystem. I don't know can another trash directory be defined in that partition so that gnome can use it?

I could have partion 2 mounted as /home with almost simular results --I did that for a long time--, but each time I change the Linux/Ubuntu installation, many configuration files in my home become broken. But in summary this new scheme doesn't allow me to use gnome trash now.

8

GNOMEish file managers need a place to put the trashed files. Copying them to the 1st partition would be very bad performance. So it tries to put them in the /.Trash-$UID folder. Without rw access to that folder, no trash.

Run this bash in the partition root as the user who needs a trash.

sudo mkdir .Trash-$UID && sudo chown $USER:$USER .Trash-$UID

Note: If there is a a rw .Trash folder, Nautilus may create the user's trash folder automatically (/.Trash/$UID). I haven't tried this, just saw it in some logs. There are security issues with public trashes. YMMV.

  • On Ubuntu 18.04, do below: cd <mount-point-of-new-partition> && sudo chown root.root .Trash && sudo chmod ug-s .Trash && sudo chmod 1777 .Trash – Amil Waduwawara Jun 24 '18 at 12:24
12

When you delete a file on a removable storage device, GNOME automatically creates a trash folder at the device's root. If your user ID is 1000, it will create a file named /data/.Trash-1000. When you go to the Trash place in Nautilus, you see an amalgamation of all the trash folders for your user on all the filesystems that are connected.

It sounds like this one is a permissions issue. GNOME is trying to create the trash folder at the device's root, but perhaps your user only has access to individual files under the root. The easiest way about this is to make the thing more accessible. In a terminal, try sudo chmod 777 /data to make the root of your data drive editable to any user. Alternatively, you can do sudo chown yourname /data for a similar effect.

  • on the spot! As you said, just needed to do 'cd /data; chmod o+w .', (I guess it will also work to manually create /data/.Trash-1000 with the right permissions). Worked right away. (jeje, now I couldn't find the Trash in 11.10! ok, it is on the left panel in Nautilus) – alfC Oct 20 '11 at 3:53
  • 1
    I have my SSD mounted as / and some of the folders in my user /home mount (on a mechanical hard drive) are symlinked onto the SSD drive. While your fix (I created a .Trash-1000 off of /) allows me to use the move to trash option, I can't see the files I've deleted inside the Gnome trash in Nautilus. Any suggestions? – James McMahon Apr 30 '12 at 14:31
  • 3
    For security reasons, I'd suggest to created the .Trash-XXXX folder manually and give it the right permissions (755 or 750) for userid XXXX, instead of using 777 for the root directory of the other partition. – Toon Verstraelen May 28 '14 at 7:09
  • 1
    @James: you have to create the .Trash-XXXX folder in the root directory of the mounter partition, e.g. /mnt/data, not in /. – Toon Verstraelen May 28 '14 at 7:11

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.