How do I use gnome trash for files in different partition?
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.
Solution 1:
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.
Solution 2:
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.