Disk local trash in KDE?

Hi,
In my old Kubuntu I added .Trash/1000 or .Trash-1000 to the root of mounted partitions. (with correct permissions of course)
This way when I deleted a file it was moved to this directory instead of the trash in home.

Now this does not work any more which puts a lot of strain on the system SSD when deleting big files.
On my old system I used softlinks to integrate external drives like this:
/home/user/Home -> /media/DATA/home/user/Home
This usually broke apparmor…
So this time I tried to use bind-mount like this:

LABEL=MANJARO                  /                ext4 errors=remount-ro,relatime 0 1
LABEL=DATA                     /run/media/DATEN ext4 relatime,nosuid            0 2
/run/media/DATA/home/user/Home /home/user/Home  none defaults,bind              0 0

could this be the cause? Where should I put the .Trash folder?
How should I integrate external partitions into my home folder?

ps. it actually does work for USB thumb drives formatted with NTFS or FAT.

thanks

Hi @JPT,

  1. As far as I’m aware, the /run/ mount point is for temporary mounts and shouldn’t be relies on to be persistent.
  2. Also, I haven’t heard about the .Trash* directory being easier on an SSD. Indeed, I do not have anything like that and my SSD’s wear is 6% in 3+ years!
$ sudo smartctl --all /dev/nvme0n1
[...]
Percentage Used:                    6%
[...]

So, I don’t really think it’s necessary.

Also see:

https://www.reddit.com/r/kde/comments/p382pz/comment/h8pdny1/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

And

…this actually makes kind of sense, according to my knowledge and understanding.

Because, I think both those file systems, at least NTFS was created by Microsoft, so it does to reason that the .Trash-* subdirectory would work on them, If the directory is, as I suspect, something “created” by Microsoft.

As for the bind mounts, I also have many of those. I don’t know about the fstab entries, they might be correct or they might not. However, from my personal experience, I recommend doing them with systemd:

I use 'em myself, and they kind of work better than a bomb.

Is your user id 1000 ?

id -u

1000 is usually the id of the first created user - the next will have 1001 …

It needs to be a directory (a folder) - not just a file with that name.

thank you for your answer but I have to correct a few things.
Later I will have a look at the links you posted.

you misunderstoood.
it is not about the trash directory. It is about copying 10+ GB to another drive on delete. Which takes time and wears out the SSD for nothing.

ehm no. .Trash is default KDE trash directory. It has nothing to do with Microsoft. But FAT and NTFS thumb drives do not have any permissions on linux by default that would deny creating the directory.

Good question. User is 1000, but group differs it’s 1001. That shouldn’t be a problem.
sure it’s a folder. As I told, It used to work.

Ah. Cool, and sorry. Just found a .Trash-1000 directory on one of my bind mounts. However, it’s not something I knew of, it’s an ext4 file system and a mechanical hard drive.

For me, the folder gets created as soon as I delete a file that has been there on that drive.
The folder has got a substructure - two directories in it (info and files).
It gets created when I use: move to trash - there is another option to “really” delete it instantly though …

If I understand correctly, you wish a deleted file (sent to trash) to actually go to another volume. This normally should not happen. However, if you try creating a symlink to the other volume (using the same name and path), perhaps that might work.

Alternatively, you could simply have the file delete immediately: Hold down Ctrl when you right-click, and rather than ‘Send to Trash’ select ‘Delete’.

Good luck.

Moving a file to another volume will wear down your SSD as much as deleting it :wink:

The OP seems to want to move a file, or not move it, I’m not really sure, which is why I need clarification. In fact, reading through it again, I’m even more uncertain what they want; so, I’ll just go with deleting a file immediately, as already said.

Furthermore, I’ll add that both moving or deleting a file (no matter the size) still writes to the volume, so nothing useful is actually achieved.

1 Like

Worrying about SSD wear on a normal desktop computer is a complete waste of time. It’s only a concern to people running 24/7 high load servers or data centers.

My current main drive, a WD Blue SN570 1TB NVMe, has a 600 TBW endurance rating. After 2.5 years it’s at 13 TB written, so life left is 100 - (100 * 13/600) = 97.8%. At that rate I’ll be dead before it is.

2 Likes

No, I want the opposite. I want the file to stay on the volume where it was before to avoid waiting for a rather long moving operation.

Yeah, I did that. But then I cannot undo a delete without some effort.

I see. Then, you have a dilemma that has no solution; if minimising disk writes is your ultimate goal.

moving to a trash folder under home sounds really weird, and i have not heard that before.

I have always been under the impression that the trash folder gets created to every mountpoint’s root.

2 Likes

?

Yes. If there are permissions.
But does not seem to work for my drive. No idea why.

The default (user) Trash directory is ~/.local/share/Trash. According to the specification, the user Trash directory is typically the default; if a file is deleted from another location it would be magically teleported to the home Trash. Maybe this is relevant to your issue.

The FreeDesktop.org Trash specification may help explain a few things for you. Particularly, if you scroll down to the heading of Trash directories.

Make a comparison of your system with reference to that information, and remember that implementations can differ between distribution platforms; Debian vs. Arch, for example.

no, default trash is meant primarily for the partition the directory is on. But it may additionally provide fallback trash location for other volumes if their trash is not available. It says it right there in your link. But it always first tries to put it in the filesystem root’s trash dir.

…and then, it continues to describe the scenario you mention.

The key seems to be that the Trash directories MUST exist. I suppose that would be worth checking. As already mentioned, the home Trash default is located in ~/.local/share/Trash; at least for Manjaro KDE.

It must exist and is where that user’s home partition trash is stored.

It may accept other mountpoints trash

Other mountpoints may have their own trash directories.