Score:1

Changing the location of Trash to a different disk?

ms flag

In a computer with Ubuntu 22.04, I have the OS installed in a SSD (first disk) and I have a 10Tb Hard Drive (second disk) for large storage. I am trying to find what is the best way to have the Trash bin folder used by the OS, Nemo, etc be located in the second disk instead of the current /home/username/.local/share?

I surely could try moving its contents manually and then creating a symbolic link to redirect /home/username/.local/share to the second disk, but searching online I found surprisingly very little on whether that may create problems. And the little I found seems to be contradictory.

Hence my questions:

  1. is that symlink approach reasonable?

  2. is there a better way to have Trash point to a location in a different disk using Ubuntu 22.04?

Score:1
cn flag
  1. No. Symlink across two volumes is bad.

Trash uses $XDG_DATA_HOME/Trash, and $XDG_DATA_HOME defaults to $HOME/.local/share when it is not set. So you could set $XDG_DATA_HOME.

The places to set it are /etc/profile.d/ (global; newest method) or /etc/profile (also global; older method) or ~/.profile (single user). Problem with this method: not every software follows the XDG specification so this might not be foolproof.

You could also use PAM and that would be using /etc/environment (global) or $HOME/.pam_environment (single user).

You need a export XDG_CONFIG_HOME="/dir/dir/dir/.config" to get a /dir/dir/dir.config/Trash

The Linux way, independent of XDG, is to mount /home/$USER/.local/share/ in /etc/fstab. Mind that HDD are slower to boot than SDDs and you need both to be ready before the desktop login happens.

Score:0
cl flag

This post may assist with your question: https://ubuntuforums.org/showthread.php?t=1917852

I would like to move the trash folder to my second hard drive that isn't on my SSD, so it can reside on my 3TB storage drive. I would like to use the Trash as a kind of archive, because I really have no reason to ever delete anything anyway. Can anyone help me with this? Also, does it complicate things for distro upgrades, etc.?

Actually that's a good idea. I delete everything, but if you move things to the trash bin that would be the place to put them with an SSD drive. Your trash directory is in your home directory (hidden directory) .local/share/Trash

The easiest way to do this would be to right-click on the directory in Nautilus and copy the directory to your second drive. This will move the directory (Trash) and the (2) subdirectories to the new location. Then delete the original directory and make a symbolic link to the new location. From a terminal in your home directory:

ln -s /media/ <name of your second location>/Trash /home/<your-username>/.local/share/Trash
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.