partitioning using 2 hard disks (SSD and non-SSD) in linux
Solution 1
On a hybrid solid-state and spinning disk system (like the one I'm typing this), you have two to three aims:
- Speed up your system: as much commonly used data as possible stays on the SSD.
- Keep volatile data off the SSD to reduce wear.
-
Optional: have some level of redundancy by using an
md(4)
(‘software RAID’) setup across the SSD and HDD(s).
If you're just meeting the first two goals, it's a simple task of coming up with a scheme somewhat like this (depending on which of these filesystems you use):
- Solid state:
/
(root filesystem),/usr
,/usr/local
,/opt
- Spinning disk:
/var
,/home
,/tmp
, swap
Since you have two disks, though, you can read the Multi HDD/SSD article on the Debian wiki. It'll walk you through setting up md(4)
devices with your SSD as a ‘mostly-read’ device (fast reads, fewer writes), your HDD as a ‘mostly-write’ device (no-wear writes, fewer reads). The filesystems that would normally go on the SSD alone can now go on this md
device. The kernel will read mostly from the SSD (with occasional, brief forays into the HDD to increase read throughput even more). It'll write to the HDD, but handle SSD writes with care to avoid wearing out the device. You get the best of both worlds (almost), and you don't have to worry about SSD wear rendering your data useless.
My laptop is running on a similar layout where /
, /usr
and /usr/local
are on a RAID-1 device across a 64 GB SSD and a 64 GB partition on the 1TB HDD, and the rest of the filesystems are on the rest of the HDD. The rest of the HDD is one of two members of a RAID-1 setup, with one disk usually missing. When I'm at home, I plug in the second disk and let the md
device synchronise. It's an added level of redundancy and an extra 1–7 day backup¹).
You should also have a look at the basic SSD optimisation guide for Debian (and friends).
Oh, and it's not guaranteed you'll be able to do this all via the installer. You may have to boot a rescue disk prior to installation, prepare (at least) the md(4)
devices (I do the LVM PVs, VGs and LVs too because it's easier on the CLI), then boot the installer and just point out the volumes to it.
¹ RAID ≠ backup policy. I also have proper backups.
Solution 2
I came up with the following solution:
/dev/sda2 /boot ext2 300MB
/dev/sda3 root ext4 - the rest space of the sda
/dev/sdb2 swap 8G (it seems it's recommended to allocate swap partition on the non-SSD drive)
/dev/sdb3 /tmp 10G
/dev/sdb4 /home - the rest space of the sdb
Related videos on Youtube
Askar
Updated on September 18, 2022Comments
-
Askar over 1 year
I have the following free spaces on 2 disks:
- SSD - 240G (sda)
- non-SSD - 240G (sdb)
I understand that I should use SSD to install packages and non-SSD just for storing data. What's the best partitioning schema (including swap) in my case?
When I tried automatic partitioning it installs only on 1 disk and dedicating 8G for swap.
PS. I'm going to install Linux Mint as a dual-boot alongside with Windows 7, which is already installed.
UPDATE: I have 8GB of RAM Windows has been installed on non-SSD drive.
-
user over 10 years
-
Gabriel over 10 years
-
Askar over 10 yearsI have updated my post. Windows has already been installed so no need to allocate space for it. Also, I don't need/want to create NTFS partition.
-
Salaros about 9 yearsYou forgot to mention what /dev/sda and /dev/sdb are. I know that sda is SSD, while sdb is HDD, but people who are new to these things might get it wrong
-
Run CMD over 8 yearsDropping by in 2015, finding the Q&A useful, I'd add
/srv
to the list of directories for the spinning disk. -
spectras over 8 yearsWhat I like in this scheme is it is possible to mount
/
and/usr
in read-only mode. Adds an extra layer of security against root-mode blunders. -
becko about 8 yearsWhy
/usr
and/usr/local
are treated separately? Mounting/usr
on the SSD isn't enough? -
becko about 8 yearsMore than that, just mounting
/
on the SSD isn't enough? And then specify that that/var
,/tmp
and/home
go on the HDD. -
Hilikus almost 7 years@alexios i don't understand how your proposed setup of mostly reads from SDD and mostly write from HDD works. You say you use RAID1, but RAID1 is just mirroring of the data, so any write you do in the HDD will be mirrored in the SDD. what am i missing??
-
ozanmuyes almost 5 years@Salaros actually it depends on your system configuration, for example sda might correspond to HDD and sdb might correspond to SSD. "I know that sda is SSD, while sdb is HDD..." holds truth only for this answer. Other than that you are right, the answer should've been made which one is which obvious.
-
Salaros almost 5 years@ozanmuyes I know it depends on your system configuration. I meant in his/her example