4

I want to change the directories that the links in the sidebar in Nautilus point to. I guess these are called "Places". e.g I want to link ~/Downloads, ~/Documents and others to another harddrive, for example one mounted under /mnt/OtherHarddrive/Documents

This was a trivial task in earlier versions of Ubuntu, but I am unable to achieve it in 20.04. In earlier versions, I just dropped a link to the new folder into the home folder after deleting the original.

If I do this now, then the folder in question disappears from the sidebar in Nautilus after a restart. At the same time, user-dirs.dirs in ~/config is changed to match (since I deleted the folder) (e.g. after deleting and replacing ~/Downloads with a link to some other location, XDG_DOWNLOAD_DIR="$HOME/Downloads" is replaced with XDG_DOWNLOAD_DIR="$HOME/", after a reboot. Commands like xdg-user-dirs-update --set DOWNLOAD /mnt/OtherHarddrive/Downloads/ on the other hand, have no effect at all, user-dirs.dirs does not change.

Setting XDG_DOWNLOAD_DIR directly to the new harddrive, also doesn't work. However i am unsure if this is because the drive in question is not mounted fast enough during boot, or for some other reason.

How do people normally do this? Why is this so hard all of a sudden?

Edit: In case it matters: all drives are encrypted via cryptsetup. At boot root is unlocked via passphrase, and then all other drives are are unlocked via a keyfile that is stored on the root drive (I set this up via the gnome-disks utility) I initially thought that this fact is not important, since it worked in earlier ubuntu versions, for a similar setup (In that case I added the keyfiles manually)

3
  • Is the drive mounted via /etc/fstab? Late mounting seems unlikely, because user dirs, I presume, is only taking effect when you log in. In principle, linking should still work: I do it this way for the Templates folder in Ubuntu 20.10.
    – vanadium
    Jan 21, 2021 at 11:08
  • The drive in question is mounted via /etc/fstab, yes. but it is also encrypted via cryptsetup. Will that affect things?. Furthermore, the behaviour seems erratic to me. If I set the directory manually in user-dirs after it gets reset to $HOME, it seems to function okay for 1(maybe more) reboot, before it gets reset again. At this point it's not clear to me if the behaviour is deterministic, or random.
    – Bernhard
    Jan 21, 2021 at 18:25
  • It is the encryption, of course. Add this essential information to your question: use "edit".
    – vanadium
    Jan 21, 2021 at 18:33

1 Answer 1

0

Possibly this is not the technical answer that you are looking for, rather a workaround.

How do people normally do this?

I for one have set myself free from this headache, and the mess that /home/<USER>/ is (mine now contains some 5800 files weighing over 800MB — without the caches(!) — that is just OS/apps related stuff), by creating myself a separate, independent partition that contains my actual files that I care about. (This could just as well be on a separate disk, as in your question, I believe.)

I leave /home/<USER>/ for just the things that the OS and the apps do in there. I don't try shaping it for my own taste any more. However, I still back it up regularly, of course; some of those config files in there are of extreme value.

My independent partition is mounted automatically in /etc/fstab, to the location /my-dir/ (not under /home/, but directly under /). I have a customized Nautilus launcher to make it open there by default.

Regarding the Nautilus sidebar, items to locations that one does not need, can be turned off by redirecting them to $HOME in ~/.config/user-dirs.dirs, e.g.: XDG_MUSIC_DIR="$HOME" This will make that link go away permanently, eliminating unwanted clutter. In turn, frequently accessed directories on my own partition can be added to the sidebar's bookmarks section, just underneath the aforementioned locations.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .