2

I have a removable media (SD card) which automatically mounts itself when I log into Ubuntu. I want all my user directories (Music, Downloads etc) in that removable media. I modified the .config/user-dirs.dirs file to point to directories in $HOME which have symbolic links to directories in the removable media. But every time I restart my computer, the directories reset to $HOME/ instead of, for example, $HOME/downloads -> /media/username/removablemedia/downloads.

My guess is that when I log into Ubuntu xdg-user-dirs-update runs before the SD card gets mounted. Since it cannot find the directories (symlinks point to void as of now), it defaults to $HOME/. I know this because when I change the values in .config/user-dirs.dirs to directories in my $HOME, the changes persist.

So is there a way I could make Ubuntu such that it mounts the SD card first and then executes xdg-user-dirs-update?

aa8y
  • 278

2 Answers2

1

Sorry for the extremely late reply, but there are 2 solutions to your problem:

  • Do system-wide mounting rather than per-user mounting.

  • Prevent xdg-user-dirs-update from running (and resetting your configuration at each session start up) by adding enabled=False to your user-dirs.conf file as mentioned here.

0

If your theory on broken links is correct, you can try to create placeholder files/directories in the directory where you expect the removable media to mount so the symlinks will not appear broken. When the removable media is mounted it will be on top of your placeholders.

f01
  • 246
  • But what happens when the Ubuntu tries to mount at the same location. It'll not replace the (placeholder) directories then. I'll just create one with new names. – aa8y Dec 02 '14 at 07:41
  • I was expecting to overmount your placeholder directories. Example in this question http://askubuntu.com/questions/29656/does-a-mountpoint-have-to-be-an-empty-directory – f01 Dec 02 '14 at 08:17
  • Well, it's not overmounting. It's just mounting in a different location, like instead of doing /media/user/rmmedia it's using /media/user/rmmedia1. Even mounting it manually is not working. – aa8y Dec 03 '14 at 01:47