I have a computer with an SSD and an HDD. I want to put the directories that do not change often in the SSD and the ones that do in the HDD. This means keeping root / in the SSD, along with most paths by default, and putting in the HDD /home, /opt, /root, /tmp, and /var, if I'm not mistaken.

There are two options: symlinks and bind mounts in fstab. This is explained in many questions:

  1. How to mount multiple directories on the same partition?
  2. Are there any drawbacks from using mount --bind as a substitute for symbolic links?
  3. How to mount multiple directories on the same partition?
  4. Mapping the home folder to a different location in fstab
  5. How to re-mount a different partition as /home?
  6. Can I change the /home folder after ubuntu installation?
  7. Debian install, mounting /var /tmp /home in the same partition
  8. Many more...

Each method has different pros and cons. The biggest problems being that symlinks are not transparent (e.g. to cd or pwd), and that bind duplicates the paths and the data accessed, (e.g. when using find).

Of these two problems, the latter seems easier to solve, but I could not find any mention to this in the previous links, hence I have to ask if there is any solution or not.

I think that the best solution may be binding the previous paths (/home, /opt, /root, /tmp, and /var) as subpaths of /.hdd (a new one, defined as mount point in the HDD partition) and then hiding /.hdd to avoid the problems that arise when binding the directories. The question is how to hide /.hdd in the easiest and most effective way without breaking anything. I can think of two ways.

  1. Setting its permissions to 000, which may not be very useful as root or when sudoing.
  2. Using chroot, which may break some things.

These options are not mentioned by anyone so I guess they are useless or worse than useless, why? Are there any good options? (to make /.hdd as invisible as possible, while subpaths remain binded transparently).

  • Sorry for the long link list, I tried to make clear that this is not a duplicate of those or similar questions. I know this kind of questions look like duplicates easily. – Trylks Dec 15 '17 at 1:43
  • Why not make individual partitions in the HDD for these? Partitions are cheap. Also, if /opt changes often for you, /usr might too, and at that point, there's not much left in /. – muru Dec 15 '17 at 3:12
  • I've never tried what happens if you first rebind things from /.hdd and then try to mount something else over the mountpoint /.hdd, but if that works, that might be useful to consider? – Ulrich Schwarz Dec 15 '17 at 7:01
  • Your requirement seems to be the opposite of what many people want, iwhich is for the fast SSD to be used for often changing data. In any case, you might also look at automatic caching solutions like bcache and dm-cache, or mount -t overlay. – meuh Dec 15 '17 at 8:45
  • @meuh apparently, SSDs are much better than years ago but still less durable to writing in them than HDDs. WRT caches, they make installation and maintenance more difficult, and the performance is never as good as just using the SSD. – Trylks Dec 16 '17 at 19:22

Your Answer

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

Browse other questions tagged or ask your own question.