I have symlinks to Desktop, Documents, Downloads, Pictures, Music, and Videos which link to a second hard drive. I am mounting the other hard drive through /etc/fstab. All the links work on start up, but it must be mounting the other drive after setting the desktop, because the view of the desktop reverts to the /home/user folder. (Symbolic link of desktop still goes to other drive.
How to Make Symlink to Desktop Work at Startup on Ubuntu 14.04
mountstartupsymbolic-link
Related Solutions
Correct me if I'm wrong, but it sounds like you do not auto-mount the drive (and/or make the links) at startup.
To do this, you need to add a line to your /etc/fstab
file. I'm not sure if you've ever done such a thing before, so I'm going to walk you through step by step. If anything is unclear, please let me know.
In the dash, search for terminal
. Run it. In the terminal window that appears, type
gksudo gedit /etc/fstab
Enter your password in the window that pops up. In the gedit window that pops up, add a line (or lines) that refers to your documents drive, and/or bind
s everything to your own liking.
As an example, here is my setup:
# data drives
LABEL=data1 /mnt/data1 ntfs defaults 0 0
LABEL=data2 /mnt/data2 ntfs defaults 0 0
# binds
/mnt/data1/Apps/ /home/rody/Apps none rw,bind 0 0
/mnt/data1/Audiobooks/ /home/rody/Audiobooks none rw,bind 0 0
/mnt/data1/Desktop/ /home/rody/Desktop none rw,bind 0 0
/mnt/data2/Dev/ /home/rody/Dev none rw,bind 0 0
/mnt/data1/Dropbox/ /home/rody/Documents none rw,bind 0 0
/mnt/data2/Downloads/ /home/rody/Downloads none rw,bind 0 0
/mnt/data1/eBooks/ /home/rody/eBooks none rw,bind 0 0
/mnt/data1/Games/ /home/rody/Games none rw,bind 0 0
/mnt/data1/Videos/ /home/rody/Videos none rw,bind 0 0
/mnt/data2/Music/ /home/rody/Music none rw,bind 0 0
The top three lines make Ubuntu aware of the drive, in my case, 2 drives. It attaches them to directories inside /mnt/
(which is the conventional location). It is quite possible that you need to make new directories here (don't forget sudo
).
All the other lines are just to link directories on the data drives to directories in my home directory. When creating bind mounts, also those directories need to exist in your home directory as well.
Note that I use drive labels to refer to my drives -- I think this is the best and most stable way to do it. You can find out (or set) your document drive's label in, for example, the Ubuntu disk utility
(search for it in the dash).
I think I figured out what is the best way.
Firstly I used tweak tool. Tweak tool used xdg
thing. I just don't like it so much. Then I used symbolic links for all of my old directories from /home/can
to /media/DataNtfs
.
For example; ln -s /media/DataNtfs/Music ~/Music
.
It was simple and useful until I wanted to sync my Documents directory with Ubuntu One. Ubuntu One syncs directories only in the home folder and don't work with links.
Then I create empty directories in home like Documents, Downloads, Pictures etc.. and used fstab file to bind my old NTFS directories to the empty directories.
This is part of the fstab file:
# binds
/media/DataNtfs/Music /home/can/Music none rw,bind
/media/DataNtfs/Pictures /home/can/Pictures none rw,bind
/media/DataNtfs/Downloads /home/can/Downloads none rw,bind
/media/DataNtfs/Documents /home/can/Documents none rw,bind
/media/DataNtfs/Backups /home/can/Backups none rw,bind
/media/DataNtfs/Notes /home/can/Notes none rw,bind
/media/DataNtfs/Other /home/can/Other none rw,bind
/media/DataNtfs/Packages /home/can/Packages none rw,bind
/media/DataNtfs/Photos /home/can/Photos none rw,bind
/media/DataNtfs/Videos /home/can/Videos none rw,bind
/media/DataNtfs/WorkSpace /home/can/WorkSpace none rw,bind
Bind works well. Now I can sync some of data directories with Ubuntu One. As if data directories are actually in the home directory. So I think 'the best way' is bind.
By the way; DataNtfs partition is always mounted by fstab and I never unmount it.
Best Answer
I figured it out. The first time I restarted I hadn't entered the mount commands in fstab correctly. I had them as:
where the X is the proper suffix. (I used
sudo gedit /etc/fstab
in terminal to edit the fstab folder, anddf -h
to find the proper suffix and the pathtomounteddirectory.)I had changed the fstab commands to:
I verified the filesystem type using
parted -l
.Anyways, my initial error had changed my
user-dirs.dirs
file found in my.config
folder under my Home directory. (You can make it visible usingctrl + h
outside terminal or usingls -a
inside terminal). Once I reedited myuser-dirs.dirs
file, everything worked fine.