Practical partition strategies when installing Linux
In the very first time of installing any Linux distributions, I got confused at the partitioning step. After years of experience, here is how I am doing now and I am quite satisfied with this partitioning strategy.
From the beginning to end (left to right) of the disk:
- 500MB, FAT32, EFI System.
- 1x to 2x times of RAM capacity, or maximum at 64GB, for swap (usually, 1.5x to 2x range is preferred). The exactly recommended amount depends on the total capacity of the disk.
- 64GB to 128GB, Ext4, mounted at root (
/
). - The remaining is Ext4 type and mounted at home
/home
.
Examples
In my 256GB SSD hard disk, 16GB RAM, everything should be minimum to spend disk space for the home directory: 500MB for EFI, 16GB for swap, 64GB for root, remaining ~175GB for home.
In another machine, there is a 512 GB SSD hard disk, 32GB RAM: 500MB for EFI, 50GB for swap, 128GB for root, remaining 334GB for home.
If you have 1TB or more, then you should specify a maximum amount for each partition and you still have plenty of space for the home, i.e., your working space.
Docker's directory
If you are going to use docker frequently in your newly installed OS, I highly recommend separate a volume mounted in a secondary hard disk for docker. In my case, I mount a directory in my 2TB HDD disk for docker.
If you do not have a secondary disk, you should rather create a directory inside /home
and redirect your docker service to use that directory.
I also have another post on specifying the docker home directory.