2

I have a 512 GB SSD and a 1 TB HDD on my laptop. I already have Windows 10 installed on this machine and I am about to install Ubuntu 18.04 along with it. I have 214 GB of unallocated space in the SSD and 488 GB of unallocated space in the HDD, which I can use for Ubuntu.

I am planning to dedicate 100 GB from the SSD for /. Now, I am a bit confused about /home. I want to use rest of the unallocated space in SSD and all the unallocated space in HDD for /home. I have two options:

1) Mount SSD space as /home and create a mount point inside /home, called sub_home to mount the HDD space.

2) Mount HDD space as /home and create a mount point inside /home, called sub_home to mount the SSD space.

But I want to make sure that I am able leverage the speed of the SSD and I am not sure if I will be able to do that if I go with the second option. At the same time, if I pick the first option, Ubuntu folders such as Documents, Downloads, Pictures etc. will be created in the SSD which I prefer to avoid. Please provide guidance. Note that the top priority is speed of SSD.

Also, is there a possibility of assigning one of them as /home and mounting the other outside of / and /home? Will such an approach create any issues? I have never used any mount points other than / and /home, except for external drives and SD cards.

Edit1: I believe I need to clarify the question based on the comments. I am not planning to use SSD for usual Ubuntu /home folders such as Documents, Downloads, Pictures etc. I am planning to use it to keep machine/ deep learning datasets, gazebo simulation models, ROS files etc. I thought these files might benefit from the speed advantage.

skr
  • 191
  • Yes. I meant /. It was a very careless mistake from my part. I will edit the question. – skr May 25 '18 at 05:26
  • Can you be more clear on what you want ? First you say " I want to make sure that I am able leverage the speed of the SSD" ; but then you say "Documents, Downloads, Pictures etc. will be created in the SSD which I prefer to avoid" . How do you plan to "leverage the speed" and "avoid" the ssd at the same time ? – Panther May 25 '18 at 06:10
  • IMHO storage of Documents, Pictures and Videos on an SSD is a pointless waste of performance. IF you want to leverage the speed of your SSD without wearing it out with excessive writes, the only things that should be on your SSD is your OS and programs. The system will cache data files as they are opened anyway, so anything you use repeatedly will be plenty fast without resorting to storage on the SSD. – Elder Geek May 25 '18 at 16:48
  • @Panther : I have added an edit which clarifies the question further. – skr May 25 '18 at 17:31
  • @ElderGeek Please see the edit. – skr May 25 '18 at 17:31
  • 2
    You can keep /home inside / (root) on SSD. I do that just for the user settings which then are tiny. And I move all my standard folders to a /mnt/data partition and link those back to /home. You can choose to only move & link some or all. https://askubuntu.com/questions/1013677/storing-data-on-second-hdd-mounting – oldfred May 25 '18 at 17:40
  • @oldfred Thank you for the idea. I now have more clarity on what I need to implement. – skr May 25 '18 at 18:05
  • @skr_robo Thank you for the clarification. Hopefully my answer will provide you with everything you need. – Elder Geek May 25 '18 at 20:41

2 Answers2

2

The beauty of a Linux file system is that you can mount any device, any place you please. For instance if you have large data sets, too large to be cached effectively by available ram you can choose a folder named whatever you want, wherever you want on the tree.

Some folders already in existence on the system are well suited for specific tasks. I often mount big data drives on /srv for instance. To be compliant distributions include this folder but I have not seen it used much in the past decade other than for my own purposes.

As an example: Say your SSD drive is /dev/sda and you partition it such that you have ~100 GB primary partition /dev/sda1 on the SSD for / and you decide that the remaining ~400GB on the drive which you've partitioned as /dev/sda2 will be used for data storage and mounted at /srv your /etc/fstab file would look something like this:

# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=06a31723-1f61-4bae-ae5d-403cd35d0adc /               ext4    errors=remount-ro 0       1
# /home was on /dev/sdb1 during installation
UUID=a2a0bb88-9faf-4e83-91cc-f687e1b4525a /home           ext4    defaults        0       2
UUID=7a6cc92c-4c0d-42e2-baac-373287cf5b80 /srv      ext4    defaults    0   2       
# swap was on /dev/sdc2 during installation
UUID=f0f7785c-25b5-4770-b2b3-fd618ebf58c7   swap    swap    defaults    0   0

The installer is very good at allowing you to specify specific partitions for default mount points, but you can also create your own, anywhere and mount them via /etc/fstab. It's entirely possible to have a different drives/partitions mounted at / , /SSD , /HDD , /bin , /opt , /home , /home/Documents , /srv/ /srv/data etc, etc, etc.

The only limiting factor on the number of drives is the space available to place them and the power available to run them. IF you had 50 bays and table space for 10 external drives you could mount them all, anywhere on the tree you would like. There are also methods that allow for making numerous drives appear as 1, but I won't go into that as it appears that you want more control over which device is being read from and written to than is allowed by such approaches.

EDIT: There's a decent write up on the `Nix directory structure here.

If anything about this answer is unclear, please drop me a comment and I'll do my best to elaborate.

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • Thank you for the detailed answer and the link. All the comments and answers have helped me understand what is to be done in my case. – skr May 27 '18 at 15:42
  • Just to clarify, even when a high speed device like SSD is mounted in a location which resides inside a lower speed device like HDD, the speed of SSD will not be compromised? – skr May 27 '18 at 15:45
  • 1
    @skr_robo To clarify the higher speed device does not reside inside a lower speed device. the branch of the tree where it is mounted may make it appear as if that's the case and it's understandable why one might think so, but that is not the case. You could easily prove this by running a speed test writing and reading data from a file located there and timing it. using commands like dd and time or simply copying a file to and fro. If your uncertain, it's been my experience that it's best to test the assumptions provided by others. I welcome you to do so with mine as well. – Elder Geek May 27 '18 at 17:23
  • This answer isn't clear enough for the question to be used as a duplicate target. I would prefer something like: You could create a filesystem on the 2nd partition and persistent mount that directory to a mount point in your home directory through fstab. I also commented below Byte Commander's answer. Let's see who wants to have posted the accepted answer to the duplicate target question. – karel Oct 04 '20 at 10:08
  • @karel Sorry I missed this earlier in the month. I've been crazy busy. Since I don't see Byte Commander's answer here I assume the decision has been made. Cheers! – Elder Geek Oct 28 '20 at 18:16
1

I have used mhddfs to make multiple physical disks appear as one, this might fit what you are looking to do. There are other tools as well, mergerfs, unionfs, and aufs

So you could mount one disk as /media/ssdhome and another as /media/hddhome, combine them as /home. Then inside each you could make a symlink to the other disk called sub_home, or just utilize the /media/ paths when creating new files.

rtaft
  • 1,825
  • 1
    If I do that, I will not be able to put my priority files in SSD. I need to be able to tell if a file resides in HDD or SSD. – skr May 25 '18 at 17:47