1

I've tested Manjaro for a few months and now want to test Arch. However, the same problem as the one I got into when installing Manjaro showed up: how should I partition my disks? I have a 112GB SSD and a 1TB HDD, and my system supports UEFI.

From my basic understanding on how partition are used, I had made the following setup:

On /dev/sda (SSD):

  1. /dev/sda1 mounted on /boot, vfat FS, 247MB (48 used)
  2. /dev/sda2 mounted on /, ext4 FS, 110GB (77G used)

On /dev/sdb (HDD):

  1. /dev/sdb1 mounted on /tmp, ext4 FS, 16GB (49M used)
  2. /dev/sdb2 is my swap, 8GB
  3. /dev/sdb3 mounted on /var, ext4 FS, 16GB (9.4GB used)
  4. /dev/sdb4 mounted on /home, ext4 FS, 878GB (260GB used)

This configuration has run quite well, even though there were some problems:

  1. My /var is too small, which got me errors because of pacman cache
  2. Since the SWAP is rarely used and that SSD aren't anymore as "fragile" as they used to be, wouldn't it be a good idea to put the SWAP on the SSD?
  3. What if I want to replace my SSD for a bigger one? Wouldn't it break the system if /etc is on the SSD?
  4. I never got the confirmation that this was optimal (surely because it isn't).

I looked for answers and found some posts (on reddit especially) but most of them are several years old. I also looked at the Arch wiki, but I've found what I want neither on the installation page nor on the SSD page.

What would be your thoughts about it? Would you make a more complex partition scheme (specifying where /etc should be mounted, etc...)? Are there some basic common mistakes to avoid?

  • What is the size of your RAM? Do you use legacy or UEFI boot? – dirdi May 31 at 10:53
  • I would really love to VTC as opinion-based. In your bounty, you state you want a canonical answer. There cannot be one because everyone has different requirements and different hardware. This question is more suitable for a discussion-based format, not this site’s QA format. – Daniel B May 31 at 11:18
  • @dirdi, I have 8GB RAM and use UEFI boot – g2i May 31 at 13:39
  • @DanielB, I thought a canonical answer was the way to go, since I thought of the question as a more general one: how to partition the SSD/HDD for installing an OS on them. Of course the exact sizes of the partition are user-based, but I have hoped for a more general explanation, that will allow someone to adapt the answer to their particular case, hence the canonical answer. Should I have put something else? – g2i May 31 at 13:39
1
+50

There's no best way to partition disks that meets everybody's needs, but I can make a few suggestions based on what you've told me.

1. Move /home back to the SSD

Your /home directory is currently too big for the SSD, so you've put it on the HDD. If your /home is like mine, most of the space is taken up by movies, music, and photos. You can shrink the size of /home by moving these large, infrequently accessed files to the HDD.

Why do this? Because there are tons of config files in /home. Every time your programs run, they read these config files, which means they have to hit the slow HDD. Your programs will start and run quicker if they don't depend on the HDD.

  frequently accessed small files => SSD
infrequently accessed large files => HDD

2. Don't put /tmp on the HDD

Arch and Manjaro will format /tmp as a tmpfs by default. This means the files live only in RAM and swap space. When you reboot, /tmp is cleared. Unless you are very RAM constrained, you don't need to mount /tmp on either the SSD or the HDD.

3. Move /var to the SSD if possible

A lot of writes are going to /var while your system is running. Since /var is on the HDD, your programs are stuck waiting on slow writes. At 9.4 GB, your /var directory is a bit large, which makes me think there are opportunities to clean out some junk. These /var subdirectories are a good place to look for large files that can be deleted.

/var/crash
/var/log
/var/tmp

4. (Optional) Eliminate the swap partition

This is controversial, but if you've got lots of RAM, you can consider leaving out the swap partition. I personally stopped using swap years ago and haven't had any issues. The argument for swap is that it helps the system handle low memory situations more gracefully.

situation: we're running out of memory

   swap => slow to a crawl
no swap => probably crash

Conclusion

Here's a dead simple partition layout that I think is worth striving for:

SSD
  /      ext4
  /boot  vfat

HDD
  /      ext4
| improve this answer | |
  • 2
    Just as a side note: Eliminating swap will also disable hibernation. For one who does not use this feature your recommendation is perfectly fine. – dirdi May 31 at 10:59
  • 1
    1. So if I'm not mistaken, I should mount /home on the SSD and mount /home/bigfiles on the HDD? (I'm the only user on this machine) 2. @dirdi also advised me to do so, so I'll do it for sure! 3. Actually, my biggest folder in /var is /var/lib/snapd which takes 7.5GB (8.1 for /var/lib). The second biggest is /var/cache/pacman (3.9 GB), so I'm not sure I can clean out this partition, but it seems a good idea to put /var on the SSD (also advised by @dirdi) 4. I litterally had to use my swap two days ago, so I'm too afraid to do this for now. – g2i May 31 at 14:12
  • 1
    You could create a HDD partition for bigfiles, but you can also create directories for movies, music, etc. on the HDD and just move the files there. There's no requirement that they have to appear under /home, but it's totally fine if you prefer it that way. It's up to you :) – ryboe May 31 at 17:53
  • @g2i I suspect that your system used swap, if you did not do video rendering or smth. Depending on your configured swapiness, Linux starts to swap early to accelerate the process in case swap is actually needed. But swap is not actually used, it is just a precaution. See also this page, which is IMHO a great read for every new Linux user: linuxatemyram.com – dirdi Jun 3 at 13:42
  • Well, I did not check whether it was used or not, but I am almost sure it was. To be fair, it was just caused by me running a Python code with gmpy2 using (too) large precision, leeding to a several minutes-long freeze. But indeed, I'm quite sure that this is the only case where my system actually used the Swap. I did not know about disk caching though, thanks for the resource! – g2i Jun 3 at 15:00
2

Your setup is not that bad, but can be optimized:

  • Putting /boot on the SSD was the right choice, since this will accelerate the boot process.
  • / is also well placed on the SSD and will enable you to fire up programs in a fast manner.
  • I prefer to put /tmp on RAM (see this answer, over at Unix&Linux Stackexchange). Usually it does not grow bigger than a few hundred MiB.
  • Your swap should be the size of your RAM + its squareroot, if you want to use hibernation. E.g. if you got 8 GB ram, the swap partition should be 11 GB (8 + sqrt(8) = 11). However, if your system starts to swap you want the swap to be as fast as possible. Hence, you should place it on your SSD, too.
  • I do not see the point of having a separate /var partition. The only reason I could think of would be degenerated log files. Therefore I would instead recommend to put /var/log onto its own partition on the HDD. 512MiB should be more than sufficient.
  • The HDD was a good choice for /home.

If you go to implement my recommendations, you will most probably have to start from scratch. In this case, you should definitely have a look at the Logical Volume Manager aka LVM. LVM enables one to easily grow and shrink partitions without reinstalling the whole system.

My advised setup for your machine would thus be:

  • RAM
    • /tmp partition
  • SSD
    • 512 MiB /boot partition
    • ssd volume group
      • swap partition (see above for proper size)
      • / root partition, including /var
  • HDD
    • hdd volume group
      • 512 MiB /var/log partition
      • /home partition

If you got a portable machine that is prune to theft, you should also consider encryption (i.e. setting up the two volume groups on top of LUKS containers aka encrypted LVM).

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.