Trash not usable on bind mounts
In issue #2382 (closed) user Philip Withnall asked me to file a separate bug for an issue that seems to be around since forever (Link):
I've got a HDD drive that I want to mount into my home directory which is located on a SSD. The HDD is mounted on /home-hdd and holds the home directories of two users (some sort of cold storage which doesn't fit on the SSD).
$ ls -la /home-hdd/
insgesamt 40
drwxr-xr-x 7 root root 4096 12. Apr 21:20 .
drwxr-xr-x 18 root root 4096 12. Apr 22:45 ..
drwxr-xr-x 9 flitter flitter 4096 12. Apr 22:38 flitter
drwx------ 2 root root 16384 10. Jän 2016 lost+found
drwx------ 10 media media 4096 14. Apr 21:32 media
drwx------ 5 flitter flitter 4096 12. Apr 21:20 .Trash-1000
drwx------ 5 media media 4096 17. Jun 2018 .Trash-1001
Now user media wants to access the files in /home-hdd/media under $HOME/Media_4TB... .
This is possible either by using a symlink or by creating a bind mount:
ln -s /home-hdd/media/ /home/media/Media_4TB
sudo mount --bind /home-hdd/media/ /home/media/Media_4TB_bind
Which results in:
$ ls -lad /home/media/Media_4TB*
lrwxrwxrwx 1 media media 15 12. Apr 22:46 /home/media/Media_4TB -> /home-hdd/media
drwx------ 10 media media 4096 14. Apr 21:32 /home/media/Media_4TB_bind
$ mount |grep sdb1
/dev/sdb1 on /home-hdd type ext4 (rw,noatime)
/dev/sdb1 on /home/media/Media_4TB_bind type ext4 (rw,noatime)
Now the use case:
- symlink: When I go to /home/media/Media_4TB, create a file and delete it, the file gets deleted into trash.
- bind mount: When I go to /home/media/Media_4TB_bind, create a file and want to delete it, I get asked if I wanted to delete the file permanently and the file will not be deleted into trash. Obviously, trashing is not supported.
As you can see above, the .Trash-xxxx folders exist and trashing works within the symlinked directory.
What I also tried was creating the .Trash-xxxx folders in /home-hdd/media/ (respectively /home/media/Media_4TB_bind), but this didn't work either.
BTW: Surely, the discussion would arise where to look for/create the .Trash-xxxx folder.
I personally would prefer the root of the bind mount over the root of the device.