0

Before anyone wants to mark this as a duplicate: I do not want to put my /home on another partition.

I'm going to buy a 250GiB SSD to replace the 640GiB HDD in my laptop computer. However, since 250GiB is too less space for my files and the system, I'm going to remove the DVD drive and install the HDD into the now-empty space using a HDD Caddy, where I want to put my files onto.

However, I still want things like ~/.config, ~/.local etc. on the SSD, since my HDD is a real performance bottleneck and applications will most likely load faster if all their config is on the SSD. But all other stuff I want on the HDD: Documents, Pictures, Music, ...

Is there any way to accomplish this in a way where I don't notice the partition difference? E.g. I'd like not to mount all my data at e.g. /media/data, but I'd like to have the directories from the HDD root mounted 1:1 inside my home. Where and how woud I have to mount the HDD root?

E.g.:

/home/username/
    .config/
    .local/
    .PlayOnLinux/ # -> not sure yet
    Documents/ -> HDD/Documents/
    Pictures/ -> HDD/Pictures/
    Downloads/ -> HDD/Downloads/
    .bashrc
    #...
    #Anything undefined to SSD
  • Just guessing here, cause this is an interesting problem. I suspect your are going to have to create links from /home/username for the directories which are not located in the physical implementation of /home – Charles Green Nov 18 '14 at 21:28
  • So basically mount the HDD via fstab and create symlinks for each directory on the HDD? That could work, but it doesn't sound really elegant. – s3lph Nov 18 '14 at 21:30
  • No it doesn't, and I believe some programs do not follow symlinks really well. – Charles Green Nov 18 '14 at 21:32
  • 1
    I have done linking like this for years. askubuntu.com/questions/223655/… But have seen one or two suggest using bind as that may work better with networked systems. But mine are not networked. I do use NFS to copy data from one system to another but use under lying file not link. – oldfred Nov 18 '14 at 23:03
1

the mount command as a bind option where you can mount a partition at a second place (sort of)

so you can have in your /etc/fstab something like

/dev/sdb3 /media/SSD_home ...
/media/SSD_home /home/username/.config none bind

the second line is to bind the mount to the correct place

This has not been tested; it's jsut an idea

| improve this answer | |
  • But then anything placed inside /home/username goes to the HDD, doesn't it? – s3lph Nov 18 '14 at 22:38
  • I was thinking about using mounts to do this, but I think that would then entail a separate partition for each directory to be placed in this manner. – Charles Green Nov 18 '14 at 22:59
1

This is completely possible.

Mount your HDD via fstab.

Modify the ~/.config/user-dirs.dirsin your home directory.

You can modify the entry by changing XDG_PICTURES_DIR="$HOME/Picture" to XDG_PICTURES_DIR="/<your_pictures_directory>".

The same thing goes for any other such directory.

My setup below:

This will also change the bookmarks in the places column so you can easily navigate across directories. Programs also don't have any problem whatsoever.

After this change, the programs will start using the new directories. Though the earlier folders will still exist, they wont be used by any programs. You need to remove them and replace them with symbolic links to your new directories. These symlinks are completely for our convenience only and have no impact on programs.

| improve this answer | |
  • 1
    If @the_Seppi were to change only the ~/.config/user-dirs.dirs file, would thre be an entry somewhere in ~/ that points to the correct location unless he also makes the symbolic link? – Charles Green Nov 18 '14 at 21:58
  • there would be no entry in the present location, because logically, he just moved away those folders to a new place. He definitely has to delete the now redundant folders and create symbolic links to the new ones. The symlinks are just for our convenience only and have no impact on programs. – astrob0t Nov 18 '14 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.