Trashing files on other drives copies them to the Trash directory on / (btrfs edition)

Hello everyone.

A few months ago I came with the same problem with an NTFS formatted drive: deleting a file caused it to be copied to the main drive Trash, instead of the Trash folder on its own drive.

Although the solution I was given didn't work (I didn't notice until the post was locked a few dais after, sorry about that), I found how to mount the drive with an usable trash folder by adding "uid=1000" to the mounting options.

I recently acquired a third drive and decided to use BTRFS as it is the default file system for Garuda, and by the way, reformat my old NTFS to BTRFS as I don't plan to go back to windows as long as I can help it.

The problem is that I have again the same issue:
Files deleted in the two secondary drives are moved to the trash of the main one. My old solution won't work as the mounting point option "uid=1000" is not compatible with BTRFS (I had a nice afternoon trying to boot again after I tried it).

No ".Trash-1000" folder was automatically created in these drives. I created it myself and the system created the two sub-folders "files" and "info" itself. I can see the three locations in the Trash tab in Dolphin's configuration and even set a different quota for each one. However, every time I delete a file, it gets moved to the Trash in the main drive instead it's own.
The permissions are WRX to me and my usergroup and the sticky bit is checked.

Here is my Garuda-inxi:

╰─λ garuda-inx
System:
Kernel: 6.0.9-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=810cddd0-3d54-45f7-88fa-84f8b12b1038 rw [email protected]
rd.udev.log_priority=3 vt.global_cursor_default=0 loglevel=3
Desktop: KDE Plasma v: 5.26.3 tk: Qt v: 5.15.7 wm: kwin_x11 vt: 1 dm: SDDM
Distro: Garuda Linux base: Arch Linux
Machine:
Type: Desktop Mobo: ASUSTeK model: ROG STRIX B450-I GAMING v: Rev 1.xx
serial: <superuser required> UEFI: American Megatrends v: 4901
date: 07/25/2022
CPU:
Info: model: AMD Ryzen 7 3700X bits: 64 type: MT MCP arch: Zen 2 gen: 3
level: v3 note: check built: 2020-22 process: TSMC n7 (7nm)
family: 0x17 (23) model-id: 0x71 (113) stepping: 0 microcode: 0x8701021
Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
L3: 32 MiB desc: 2x16 MiB
Speed (MHz): avg: 3825 high: 4205 min/max: 2200/4426 boost: enabled
scaling: driver: acpi-cpufreq governor: performance cores: 1: 4205 2: 3600
3: 3600 4: 3600 5: 3600 6: 4201 7: 4203 8: 4194 9: 3600 10: 3600 11: 3600
12: 3600 13: 3600 14: 3600 15: 4196 16: 4201 bogomips: 115199
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities:
Type: itlb_multihit status: Not affected
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: mmio_stale_data status: Not affected
Type: retbleed mitigation: untrained return thunk; SMT enabled with STIBP
protection
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
prctl
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
sanitization
Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, STIBP:
always-on, RSB filling, PBRSB-eIBRS: Not affected
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:
Device-1: AMD Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT]
vendor: Gigabyte driver: amdgpu v: kernel arch: RDNA-1 code: Navi
process: TSMC n7 (7nm) built: 2019-20 pcie: gen: 4 speed: 16 GT/s
lanes: 16 ports: active: DP-1,DP-3 empty: DP-2,HDMI-A-1 bus-ID: 09:00.0
chip-ID: 1002:731f class-ID: 0300
Device-2: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo
bus-ID: 3-3:4 chip-ID: 046d:0825 class-ID: 0102 serial: <filter>
Display: x11 server: X.Org v: 21.1.4 with: Xwayland v: 22.1.5
compositor: kwin_x11 driver: X: loaded: amdgpu unloaded: modesetting,radeon
alternate: fbdev,vesa dri: radeonsi gpu: amdgpu display-ID: :0 screens: 1
Screen-1: 0 s-res: 4480x1440 s-dpi: 96 s-size: 1185x381mm (46.65x15.00")
s-diag: 1245mm (49.01")
Monitor-1: DP-1 mapped: DisplayPort-0 pos: primary,top-right
model: MSI MAG274QRF-QD serial: <filter> built: 2021 res: 2560x1440 dpi: 109
gamma: 1.2 size: 597x336mm (23.5x13.23") diag: 685mm (27") ratio: 16:9
modes: max: 2560x1440 min: 640x480
Monitor-2: DP-3 mapped: DisplayPort-2 pos: bottom-l model: AOC 2590G4
serial: <filter> built: 2019 res: 1920x1080 dpi: 90 gamma: 1.2
size: 544x303mm (21.42x11.93") diag: 623mm (24.5") ratio: 16:9 modes:
max: 1920x1080 min: 720x400
API: OpenGL v: 4.6 Mesa 22.2.3 renderer: AMD Radeon RX 5700 (navi10 LLVM
14.0.6 DRM 3.48 6.0.9-zen1-1-zen) direct render: Yes
Audio:
Device-1: AMD Navi 10 HDMI Audio driver: snd_hda_intel v: kernel pcie:
bus-ID: 3-3:4 chip-ID: 046d:0825 gen: 4 speed: 16 GT/s class-ID: 0102
lanes: 16 serial: <filter> bus-ID: 09:00.1 chip-ID: 1002:ab38
class-ID: 0403
Device-2: AMD Starship/Matisse HD Audio vendor: ASUSTeK
driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
bus-ID: 0c:00.4 chip-ID: 1022:1487 class-ID: 0403
Device-3: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo
Device-4: Logitech G432 Gaming Headset type: USB
driver: hid-generic,snd-usb-audio,usbhid bus-ID: 3-4:5 chip-ID: 046d:0a9c
class-ID: 0300 serial: <filter>
Sound API: ALSA v: k6.0.9-zen1-1-zen running: yes
Sound Server-1: PulseAudio v: 16.1 running: no
Sound Server-2: PipeWire v: 0.3.60 running: yes
Network:
Device-1: Intel I211 Gigabit Network vendor: ASUSTeK driver: igb v: kernel
pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: d000 bus-ID: 04:00.0
chip-ID: 8086:1539 class-ID: 0200
IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Device-2: Realtek RTL8822BE 802.11a/b/g/n/ac WiFi adapter vendor: ASUSTeK
driver: rtw_8822be v: N/A modules: rtw88_8822be pcie: gen: 1 speed: 2.5 GT/s
lanes: 1 port: c000 bus-ID: 05:00.0 chip-ID: 10ec:b822 class-ID: 0280
IF: wlp5s0 state: up mac: <filter>
Bluetooth:
Device-1: ASUSTek Bluetooth Radio type: USB driver: btusb v: 0.8
bus-ID: 1-8:6 chip-ID: 0b05:185c class-ID: e001 serial: <filter>
Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Drives:
Local Storage: total: 3.66 TiB used: 1.42 TiB (38.8%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: A-Data model: SX8200PNP
size: 953.87 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
lanes: 4 type: SSD serial: <filter> rev: S0118C temp: 32.9 C scheme: GPT
ID-2: /dev/nvme1n1 maj-min: 259:3 vendor: Samsung
model: SSD 970 EVO Plus 2TB size: 1.82 TiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: 4B2QEXM7 temp: 41.9 C scheme: GPT
ID-3: /dev/sda maj-min: 8:0 vendor: Western Digital
model: WD10SPZX-00Z10T0 size: 931.51 GiB block-size: physical: 4096 B
logical: 512 B speed: 6.0 Gb/s type: HDD rpm: 5400 serial: <filter>
rev: 1A01 scheme: MBR
Partition:
ID-1: / raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
used: 741.07 GiB (77.7%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 608 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
used: 741.07 GiB (77.7%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-4: /var/log raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
used: 741.07 GiB (77.7%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 953.57 GiB size: 953.57 GiB (100.00%)
used: 741.07 GiB (77.7%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 15.54 GiB used: 1.57 GiB (10.1%)
priority: 100 dev: /dev/zram0
Sensors:
System Temperatures: cpu: 40.0 C mobo: 53.0 C gpu: amdgpu temp: 52.0 C
mem: 60.0 C
Fan Speeds (RPM): cpu: 655 case-1: 696 gpu: amdgpu fan: 763
Power: 12v: 9.97 5v: N/A 3.3v: N/A vbat: 3.23 gpu: amdgpu watts: 31.00
Info:
Processes: 425 Uptime: 1h 58m wakeups: 0 Memory: 15.54 GiB
used: 5.14 GiB (33.1%) Init: systemd v: 252 default: graphical
tool: systemctl Compilers: gcc: 12.2.0 clang: 14.0.6 Packages: 2004
pm: pacman pkgs: 1996 libs: 572 tools: octopi,paru pm: flatpak pkgs: 8
Shell: fish v: 3.5.1 default: Bash v: 5.1.16 running-in: konsole
inxi: 3.3.23
Garuda (2.6.9-1):
System install date:     2022-06-25
Last full system update: 2022-11-25 ↻
Is partially upgraded:   No
Relevant software:       NetworkManager
Windows dual boot:       No/Undetected
Snapshots:               Snapper
Failed units:            fancontrol.service

And my FSTAB

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>                             <mount point>                                                <type>  <options>                                             <dump>  <pass>
UUID=23C8-50C1                              /boot/efi                                                    vfat    umask=0077                                                               0 2 
UUID=810cddd0-3d54-45f7-88fa-84f8b12b1038   /                                                            btrfs   subvol=/@,noatime,compress=zstd,discard=async,ssd                        0 0 
UUID=810cddd0-3d54-45f7-88fa-84f8b12b1038   /home                                                        btrfs   subvol=/@home,noatime,compress=zstd,discard=async,ssd                    0 0 
UUID=810cddd0-3d54-45f7-88fa-84f8b12b1038   /root                                                        btrfs   subvol=/@root,noatime,compress=zstd,discard=async,ssd                    0 0 
UUID=810cddd0-3d54-45f7-88fa-84f8b12b1038   /srv                                                         btrfs   subvol=/@srv,noatime,compress=zstd,discard=async,ssd                     0 0 
UUID=810cddd0-3d54-45f7-88fa-84f8b12b1038   /var/cache                                                   btrfs   subvol=/@cache,noatime,compress=zstd,discard=async,ssd                   0 0 
UUID=810cddd0-3d54-45f7-88fa-84f8b12b1038   /var/log                                                     btrfs   subvol=/@log,noatime,compress=zstd,discard=async,ssd                     0 0 
UUID=810cddd0-3d54-45f7-88fa-84f8b12b1038   /var/tmp                                                     btrfs   subvol=/@tmp,noatime,compress=zstd,discard=async,ssd                     0 0 
tmpfs                                       /tmp                                                         tmpfs   noatime,mode=1777                                                        0 0 
# UUID=4CAA6027AA600FAE                     /run/media/antonio/WD10SPZX\040SATA                          ntfs    uid=1000,async,nofail,x-gvfs-show,noatime,nodiratime,users               0 0
UUID=b910d931-0f89-4260-a60b-5d1b3862c736   /run/media/antonio/Samsung\040970\040EVO\040Plus             btrfs   noatime,compress=zstd,discard=async,ssd,nofail                           0 0 
UUID=2ec3ded3-c3b3-478f-9015-ebdc659c69b2   /run/media/antonio/WD10SPZX\040SATA                          btrfs   async,compress=zstd,noatime,nofail,users                                 0 0 

Any help would be appreciated.

According to this ArchWiki entry, it looks like you need to add uid=1000 to each of the external drive options lines in fstab.

Won't work: I already tried it and got stuck unable to boot. I tested UID=USERID, GID=USERGROUPID, FMASK=177, DMASK=077 to no result. They might not be compatible with btrfs

Gotcha, that note must be specifically relevant for NTFS (like in their example).

Have you changed ownership of the drive to your user with chown?

Have you tried forcing a permanent delete? Shift + Del? I think if done that way, it doesn't send anything to "Trash"

I already have the ownership, I believe, but I ran

╭─[email protected] in /run/media/antonio🔒
╰─λ chown -R antonio WD10SPZX\ SATA/

just to be sure. No error output, but the problem persist.

Yeah, I'm aware of that. But my goal is to have a .Trash working as intended. :wink:

I have been searching around and couldn't find any solution on my own. Just people with the same problem.
I suppose I could reformat the drives to NFTS and mount then with the "uid=1000" Parameter, as I know the ".Trash" would work that way
Having to resort to discard the native file system and use a Windows one, for such a basic function to properly work, makes me feel a little defeated. But life keeps on I guess.

Same here, I see plenty of folks who have run into this same issue but no solution in sight. I believe this may be an issue upstream, with Btrfs; see the bug report here (still open, after three years): trash is not working on mounted btrfs subvol (internal system mounts message) (#1885) · Issues · GNOME / GLib · GitLab

There does seem to be some agreement that the issue is specific to Btrfs (Yet another "why isn't trash working" question / Applications & Desktop Environments / Arch Linux Forums), and some folks theorize that subvolumes are the source of the problem (How does trash work on btrfs? - r/btrfs), although I think the jury may still be out on that last one.

Unless you are using Windows, this is bound to be more trouble than it is worth. NTFS is easily broken on a Linux system, and not so easy to repair without a Windows box. This solution might be a case of "the cure is worse than the disease". :smirk:

I think you are on the right track though: try formatting the drive as ext4. This is a filesystem that will work much more reliably on Linux than NTFS, and should honor the trash setup you are doing as well.

5 Likes

Thanks for your answer (and patience), I'll try ext4 and post my findings :slightly_smiling_face:

I always use ext4 on my storage drives and never experience these issues, so I think you should be fine. Recovery software is far more available for ext4 and that is one of the reasons I prefer it for storage drives.

1 Like

Well, I have tested ext4 and f2fs and the trash folder works on both of then properly. So I guess that btrfs was the problem.

Thanks for the help and until next time.