0

I am trying to dual boot ubuntu on my laptop, and because I have low space on my SSD, I have allocated 20 GB to root in the SSD, and 120 GB to the home directory in my HDD. I only installed the root on SSD for faster boot times, and my main goal is to have 90% of the files installed in the HDD.

However, it seems like everything is getting installed in the root partition of ubuntu, when I instead want to install most of the programs (including the ones I install using apt-get) into my HDD. I only want the most essential files in the SSD.

Is there a way to change the install location for software in ubuntu? Or alternatively, during the install of ubuntu, can I allocate only the essential files to the SSD and have everything else install on HDD instead?

Edit: Looks like my question is misworded. What I meant was that I want to use my SSD's efficiency coupled with the large capacity of my HDD so that I can run linux a bit faster on my laptop.

quiccode
  • 129

2 Answers2

3

How do I make it so that ubuntu installs everything on /home instead of the root?

You don't, unless you have deep knowledge on how to configure a linux system differently than the conventions.

However, you can configure a linux system rather easily to have system files placed on another drive, i.e. in your case, a HDD rather than the SSD. Symlinks already would cut it - several directories of the system file structure could be redirected to a HDD this way.

Still, also that is not optimal. For performance - fast startup, fast response of the system and fast loading of programs - prefer leaving all the system files on the SSD. 20 GB is already quite adequate to contain a Linux operating system provided you have your /home directory mounted on another drive, but it still depends on how many programs you install, and whether you install applications as snap or flatpak instead of as a regular APT package.

  • You could move out your swapfile to the other drive, especially if you have 8 GB of memory or more. Swapping, however, will become markedly slower if you need it.
  • Make sure you regularly clean out old kernels, which each take a few hundreds of megabytes. The command sudo apt autopurge will remove all libraries that are not needed anymore, but also will remove all old kernels, except one: one old kernel is kept. That facilitates keeping sufficient free space on your root partition.
  • Several applications now are available as an AppImage. You place these where you want. That is another way to cut down on the number of packages you need to install in the system file area.
  • If the need arizes, and you use snap a lot, linking out system files of snap (/snap/, /var/snap/, /var/lib/snapd/) remains a possibility. Cold startup times, however, would severely worsen more over what they already are when using SSD.
vanadium
  • 97,564
2

As pointed out several times, this is idea of yours is probably not going to be as effective as you are thinking... BUT... it is not out of the way or illogical. It is usually just done for other reasons.

(in your defense) I use a system that has things like elasticsearch and database software that has a lot of indexes and logs constantly building up on them. Yes, the ideal way to deal with that would be to responsibly handle the logging or indexes, but there is no way to compensate for that if the system falls into an error state. I also worked on a system where /home has its own partition, simple because there was no way to predict what havoc "users" would release... So yes we wanted a separate partition (even disk) for those, to not have the root disk being at risk of filling and locking up the production machine.

I think the way you worded some things has caused some people to go on alert (you also have to realize that you are not going to be the only one seeking info and reading this question/answers/comments). But from what I can tell, your goal is just to use the efficiency of the limited space on the SSD for your OS, while putting the most of what you can on your HDD. If that is true, that is definitely not what the wording of your question [currently] implies. (it also says that you might not quite understand the concept of /home yet)

So, if my interpretation is correct, then you could attempt something like what I described in the comments. During the install, (choosing "something else", when you're asked how you want the install configured):

Just create a partition on your SSD, designating your "/" mount point there.

And on your HDD create several partitions. Personally, I'd say about 6 for /home, /usr, /bin, /sbin, /snap, and /var.

Here I did a bit of what you are trying to do. I put "/" on a partition (/dev/sdb1) on one drive and /home on another partition (/dev/mmcblk1p3) on a different drive. And began creating another partition for /usr... Notice some of these directory names are preloaded options, so this is meant to work this way. enter image description here (My depiction is STRICTLY an example, to show that multiple drives can be used and also to illustrate the dropdown selections... I just selected partitions that I had available to play with... I know the layout doesn't make sense)

This is going to be trial and error for you.

If you do sudo du -hd 1 / on an existing system you would get an idea of directories file size usage. Then you can make the partition sizes proportional to what you see. Now you have your partitions on your big drive, so I wouldnt be too concerned with over-sizing them, again, trial and error...(Especially if you were willing to give swap 6 Gigs!, way overkill in my PERSONAL opinion). You just have to use some logic, knowing that the entire system would normally have been stored on that 20G partition you previously installed on. (...but I can say my /snap directory has 9G in it)

I don't expect any recognizable increase in performance from this... But that is for you to figure out and experiment with. I wouldn't steer any one else towards this type of setup... but in your (the OP) case, if you have the logic in your head and you want to test it, this is a good science project for you and hopefully you'd only benefit from the lessons.

WU-TANG
  • 3,316