Skip to main content
Topic: What is the Best Way to Utilize an SSD and an HDD Together on Linux? (Read 527 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

What is the Best Way to Utilize an SSD and an HDD Together on Linux?

Hello everyone,

I currently have an SSD and an HDD in my PC. At the moment, Artix Linux is installed on the SSD, and I use the HDD primarily for long-term file storage. The reason I rely on the HDD for storage is that SSDs can be vulnerable to power surges, and I’ve unfortunately experienced a complete data loss on my previous SSD due to a failure. Because of this, I’m cautious about storing critical data on my SSD.

Long time ago, when I was a Windows user, I typically dedicated the entire SSD to the C drive and created a D drive on the HDD for storing files. I wanted to know what is the best way to utilize both an SSD and an HDD together on Linux? Most guides on the internet suggest creating a /home partition on the HDD. However, I don’t particularly like this approach because important configuration files like .bashrc, .xinitrc, and various other hidden files are typically stored in the /home directory. I think placing the entire /home directory on the HDD could potentially slow down the loading times of various software packages on my system.

So, I’m currently considering the following solution:
  • Dedicate the entire 1TB HDD to a single partition.
  • Create a mount point at ~/data (or similar).
  • Mount the 1TB partition to the ~/data mount point.
  • Move the user directories (e.g., Documents, Downloads, Pictures) to ~/data, and create symbolic links to them in the /home directory.

I believe this approach would allow me to use the SSD for the system files and software packages (keeping the performance high), while still leveraging the HDD for personal data storage. However, I’m unsure whether this approach is any good compared to a separate home partition. How do you guys utilize an SSD and an HDD on Linux? Is the approach that I mentioned here advisable? Are there any better ways to configure my system to use both drives effectively on Linux?

Any input or suggestions would be greatly appreciated!

Re: What is the Best Way to Utilize an SSD and an HDD Together on Linux?

Reply #1
Most guides on the internet suggest creating a /home partition on the HDD. However, I don’t particularly like this approach because important configuration files like .bashrc, .xinitrc, and various other hidden files are typically stored in the /home directory. I think placing the entire /home directory on the HDD could potentially slow down the loading times of various software packages on my system.

You are correct, this approach is very slow.

So, I’m currently considering the following solution:
  • Dedicate the entire 1TB HDD to a single partition.
  • Create a mount point at ~/data (or similar).
  • Mount the 1TB partition to the ~/data mount point.
  • Move the user directories (e.g., Documents, Downloads, Pictures) to ~/data, and create symbolic links to them in the /home directory.

This is almost exactly my setup. It works well for me. Curious to hear if anyone else has a more elegant solution.

Re: What is the Best Way to Utilize an SSD and an HDD Together on Linux?

Reply #2
I've been doing the same thing for years.

I also put my .thunderbird on /media/data and created a link in /home/user.

Re: What is the Best Way to Utilize an SSD and an HDD Together on Linux?

Reply #3
Curious to hear if anyone else has a more elegant solution.
I can give you an extremely inelegant solution.

In an effort to have my home partition config files separate from my data I have a another partition mounted at /home/USER/Files.
KDE is set to use /home/USER/Files/Documents  /home/USER/Files/Downloads etc etc.
Both on my fastest Nvme drive along with the rootfs, EFI and several other Linux rootfs's

/home/USER/.cache is a tmpfs.
/home/USER/Space is a second nvme drive.

All my HDD's (4) are mounted under /Media. But I mount them with .UUID eg .39b5e424-6b67-4e6f-9d62-68b9cb1a5bb6
And then symlink to a more descriptive name eg Data_rsnapshots -> /media/.e1e09e7e-0132-420e-b41b-91b2df553e7e
I'm sure there was an excellent reason why I did this with the UUID's but can't remember what is was.

It gets more complicated because large directories under /home/USER/.local and /home/USER/.config get moved to Files and symlinked.

The purpose of the small true /home partition is so that I can easily do incremental backups of my users config files with rsnapshot.

OP. Anything accessed frequently should be on your fastest storage where possible.

Re: What is the Best Way to Utilize an SSD and an HDD Together on Linux?

Reply #4
I have a 256 SSD I use for / and /home, plus 2 10TiB removable harddisks. One has 3 partitions and they are mounted in /home as outline on my /etc/fstab below. The other 10TiB is for general storage of junk I've collected throughout the 2 decades I've been using Linux.

These are what's conected to my rig:
Code: [Select]
~ > sudo fdisk -l
Disk /dev/sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk model: Maxsun  240GB X5
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 34EDDE60-3BC6-4675-AE3C-F1493D798B5B

Device         Start       End   Sectors   Size Type
/dev/sda1       2048   1026047   1024000   500M EFI System
/dev/sda2    1026048 181250047 180224000  85.9G Linux filesystem
/dev/sda3  181250048 457730047 276480000 131.8G Linux filesystem
/dev/sda4  457730048 468860927  11130880   5.3G Linux filesystem


Disk /dev/sdb: 9.1 TiB, 10000831348736 bytes, 19532873728 sectors
Disk model:  USB3.0        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: CE9CEACC-3AD4-F6A4-AB4E-B1F4785E0451

Device           Start         End    Sectors Size Type
/dev/sdb1         2048  6510958591 6510956544   3T Linux filesystem
/dev/sdb2   6510958592 13021915135 6510956544   3T Linux filesystem
/dev/sdb3  13021915136 19532871679 6510956544   3T Linux filesystem


Disk /dev/sdc: 9.1 TiB, 10000831348736 bytes, 19532873728 sectors
Disk model:  USB3.0        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 4C7EC9C9-EFE5-488F-AF59-8D3C5EAC657B

Device     Start         End     Sectors  Size Type
/dev/sdc1   2048 19532871679 19532869632  9.1T Linux filesystem
[email protected] ~ >

My fstab looks like this:
Code: [Select]
[email protected] ~ > cat /etc/fstab 
# /etc/fstab: static file system information.
#
# 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>
proc /proc proc defaults 0 0
none /dev/pts devpts defaults 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
# BOOT
UUID=925C-E02C /boot/EFI vfat defaults,rw 0 0
# ROOT
UUID=00e38eb8-aa9d-4230-9806-a7b8e8d4c7d4 / ext4 defaults,rw 0 1
# HOME
UUID=c8630c1b-bad6-4adb-9e16-73f4542f4e12 /home ext4 defaults,rw 0 0
# SWAP
UUID=80846df1-9e06-43a3-ae19-589670d2cacf swap swap sw 0 0
# FIERY FLAME
UUID=61e64195-bb48-45cc-9e19-89b205bc0f81 /home/Fiery_Flame ext4 defaults,rw 0 0
# GLACIAL GARDEN
UUID=e1c3efe6-5b94-450d-8a6e-c78a8a43a4a9 /home/Glacial_Garden ext4 defaults,rw 0 0
# URBAN DESERT
UUID=420f158f-a79a-42c5-ad6d-55f1c6d435d1 /home/Urban_Desert ext4 defaults,rw 0 0
# ARCHIE 10T
UUID=5bbbce79-ff32-4462-b615-fdbb7f89d3af /media/Archie_10T ext4 defaults,rw 0 0

My inconvenience is at bootup, and I don't know why the two 10TiB removable are automatically mounting. There are symlinks on my folder pointing somewhere on the 3-partitioned removable disk, and I can't seem to figure. It wasn't always like how it is now when everything would automagically connect.

Anyway, there are a few other things that needs figuring but those are for another thread.

S6/Plasma

Re: What is the Best Way to Utilize an SSD and an HDD Together on Linux?

Reply #5
This is almost exactly my setup. It works well for me. Curious to hear if anyone else has a more elegant solution.
I am glad that I'm not the only one doing this.
I also put my .thunderbird on /media/data and created a link in /home/user.
This is interesting. I might also move the .thunderbird directory to another partition to limit the amount of data being written on my SSD.
In an effort to have my home partition config files separate from my data I have a another partition mounted at /home/USER/Files.
KDE is set to use /home/USER/Files/Documents  /home/USER/Files/Downloads etc etc.
Both on my fastest Nvme drive along with the rootfs, EFI and several other Linux rootfs's

/home/USER/.cache is a tmpfs.
/home/USER/Space is a second nvme drive.

All my HDD's (4) are mounted under /Media. But I mount them with .UUID eg .39b5e424-6b67-4e6f-9d62-68b9cb1a5bb6
And then symlink to a more descriptive name eg Data_rsnapshots -> /media/.e1e09e7e-0132-420e-b41b-91b2df553e7e
I'm sure there was an excellent reason why I did this with the UUID's but can't remember what is was.

It gets more complicated because large directories under /home/USER/.local and /home/USER/.config get moved to Files and symlinked.

The purpose of the small true /home partition is so that I can easily do incremental backups of my users config files with rsnapshot.
This is an interesting and unique solution. I once thought about moving the configs files on /home to another partition. However, I think it's easier to just move the user directories to another partition rather than the config files and directories.

BTW, why do you mount your partitions at /media? Does the mounting point make any difference? I once mounted my 1TB HDD partition to /data but then I decided maybe it's better to mount it to a directory on my home folder. I am yet to decide the best mounting point for my 1TB partition!  :)
OP. Anything accessed frequently should be on your fastest storage where possible.
Yeah, I know this. However, I want to avoid losing my data again. Modern SSDs are fast but I find them too fragile compared to HDDs. I have a 16 year old HDD that still works like a charm, but my previous SSD got damaged in 1 year (thankfully, It was still covered by the warranty and I managed to get a free replacement).
I also want to limit the amount of data being written on the SSD. I compile my own kernel and I do this every time a new kernel is released. Compiling stuff can write a lot of data on the SSD, and ultimately shorten its life.


Re: What is the Best Way to Utilize an SSD and an HDD Together on Linux?

Reply #7
BTW, why do you mount your partitions at /media? Does the mounting point make any difference?
It's just my tradition. Originally I think I wanted anything mounted from fstab to be in a different dir than temporary mounts I used to mount in /mnt. But for quite a while I've stopped mounting temporary mounts in /mnt anyway. I create a dir in /tmp and mount there (self cleaning). Nomenclature and location don't matter really. Whatever works for you.

Quote
I also want to limit the amount of data being written on the SSD. I compile my own kernel and I do this every time a new kernel is released. Compiling stuff can write a lot of data on the SSD, and ultimately shorten its life.
Backup absolutely everything important. But imho there's not much point having super quick drives if you are afraid to use them.
Compiling on a HDD would be very slow.
Depending on how much memory you have compiling in memory, on a tmpfs, is another option.
I've given up worrying about ssd life too much.

Re: What is the Best Way to Utilize an SSD and an HDD Together on Linux?

Reply #8
I've found compiling a kernel isn't that much slower, I have various old spinning disk HDD's I use in external USB enclosures, which is also slowing down transfer times compared to SATA, and have frequently built large projects on them when short of space. They are still much faster than typical USB sticks, although you can get faster ones. The time spent reading the source or writing a module to the drive isn't that significant compared to the time needed for the CPU to do the compiling stuff, plus things can be written to a buffer without being synced to the drive instantly, so it doesn't cause a bottleneck. That ratio might alter depending on your CPU performance, you'd have to try it on the hw in question.
 I've not had any problems with the old used SSD's I've owned, touch wood! But some sources recommend leaving around 10% as free unpartitioned space for error management, which I do.

Re: What is the Best Way to Utilize an SSD and an HDD Together on Linux?

Reply #9
I also put my .thunderbird on /media/data and created a link in /home/user.
This is interesting. I might also move the .thunderbird directory to another partition to limit the amount of data being written on my SSD.
In the case of a system reinstallation and/or recovery of .thunderbird on a new file system, the mount point of the partition containing .thunderbird must be identical to what existed before.
For years, this file has always been on a partition whose mount point is /media/data.