Change location of Trash folder to something else

I want to change location of my Trash folder from /home/lain/.local/share/Trash to /mnt/hd1/Trash

I tried creating a symlink.

ln -s /mnt/hd1/Trash /home/lain/.local/share/Trash

The symlink itself is fine. However upon deleting a file via Thunar, I get error popup, saying Unable to trash file ... across filesystem boundaries. (Which is true because /mnt/hd1 is a different disk altogether)

Is there a working method to permanently make my trash folder reside on a different disk?

I’m often deleting lots of files while sorting through tens of gigabytes of pictures/ videos the family clicks, and having everything end up on my SSD feels like wastage of write cycles.

System - i3wm. Using Thunar as file manager, Ristretto as image viewer, and MPV as video player.

Edit: Didn’t need to do anything. Files aren’t being moved to SSD, so no purpose for changing Trash location.

Eh? As long as the files and trash are on the same partition, there is a pretty minimal write there since the file itself doesn’t need to move. It just updates the path to the file.

If you put your trash on a different partition, you will need to wait for the file to copied to that partition and then deleted from the current partition.

4 Likes

They’re not.

Trash is on my SSD.

Media is on a larger HDD (ext4 formatted, mounted at /mnt/hd1)

Thats why I want to move Trash from default location to /mnt/hd1/Trash.

As @dalto said, when a file is deleted it is not copied to Trash. It is moved and moving files does not cause them to physically change place on the drive. Instead, a new inode is created in the filesystem that points to the same data on the drive, and the old inode is removed. This is why moving huge files on the same filesystem is neary instantaneous. And also why hard links must point to the same filesystem.

Moving files to another filesystem necessarily involves copying them byte for byte, which is the reason why it is so slow.

3 Likes

So xfce has a single trash location and literally moves all the files there instead of keeping a separate trash location on each partition?

Umm, I have no idea how the files are actually moved :sweat:

When I delete files from my HDD, I can see them when I click “Trash” shortcut on left bar in Thunar.

Is there a way to check how / where the files are exactly being copied? Maybe the files I see in Trash are just a symlink (or some kind of link) to the files which are residing on HDD?

If it happens almost instantaneously for very large files, they are certainly being moved within the same filesystem (with data remaining at the same physical location on the drive) rather than being copied byte by byte, which takes noticeably long, even on fastest SSDs.

Hmm, just tried deleting a 9GB video. Deleting and restoring from trash was totally instant.

Checked disk space usage before and after deleting, using df and space usage didn’t change either. So files are not being moved :astonished:

1 Like

Yeah, only inodes (think of them as pointers in C) are being moved, the actual data stays on the same sectors. Even when you empty the Trash, the data is still there, only there is no inode pointing to it so the filesystem is free to overwrite that storage at a later point, when needed.

3 Likes

tl;dr - I didn’t research enough before making this post.

Ran find with the deleted file name, and apparently, the file deleted from my HDD remain on HDD, and is there in .Trash-1000/files. Compared folder sizes too; nothing is being moved to my SSD.

My initial worry doesn’t have any weight anymore.

Thanks dalto and Kresimir :pray:

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.