Linux Mint – Planning your partitioning scheme

How to install web server (IIS) on Windows Server 2019

When installing any distribution of Linux, it’s important that we first plan out how we’re going to partition the computer’s hard disk. When you partition your hard drive, you’re essentially creating artificial boundaries that split your disk into various sections. With Windows and Mac OS X, creating multiple partitions is not typical, though power users may favor this approach. Such users will often create a partition for the operating system, another partition for programs, another one for personal data, and so on. Mac and Windows computers are typically sold with a single partition, and most users will simply accept this as it is.

When it comes to Linux, partitioning is the norm and is a subject that is very commonly debated. As Linux users grow in their skills and knowledge, they will eventually come to prefer a specific partitioning scheme and in some cases, deem it superior to others. In actuality, there is no right or wrong approach to partitioning your disk. However, some partitioning schemes are better for certain tasks than others.

Including Mint, most distributions allow you to create a single partition and house the entire system within it. There’s nothing wrong with this practice, and your Mint system would operate just as smoothly with a single partition as it would with ten. For a beginner, telling the distribution to take over the entire drive with a single partition is the easiest and fastest way through the installation process. However, the use of only a single partition would cause you to miss out on some important benefits, mainly the ability to retain your files and settings after a reinstallation of your distribution.

We will go over the filesystem in more detail in Chapter 4, An Introduction to the Terminal. However, for now, there are some key concepts to start with that will aid you in making an informed decision on how to lay out the partitions right from the beginning. For starters, when I refer to filesystem in this context, I am referring to the folder and subfolder structure of a typical Linux installation. There are various folders created in the Linux filesystem, each with their own purpose. The common directories that are important for our current task are outlined as follows. However, there are many more common directories that we’ll learn about later:

  • The / symbol: This symbolizes the beginning of the Linux filesystem. For Windows users, this is equivalent to C:. All folders in the Linux filesystem are subfolders of /. For example, the equivalent of C:\MyFolder in Windows would be /MyFolder in the Linux filesystem.
  • The /home folder: The /home folder is where each user stores his or her personal files. Each user has a folder underneath /home named after their username. For example, if Sue’s username is swilliams, her home folder would be /home/swilliams.
  • The /tmp folder: Temporary files are stored in /tmp. This folder is not suitable for long term storage as the contents of the folder can and will be deleted. Some advanced users will mount /tmp in RAM to avoid having temp files written to the disk.
  • The /etc folder: Though the /etc folder isn’t typically given its own partition, this is where system-wide configuration files are stored. For example, configuration files relating to networking or running processes are stored here.
  • The swap space: While the swap area is not a folder, this is an area of your hard disk used as RAM when your memory becomes full, similar to the paging file in Windows. Swap is designated with its own partition in Linux. Often, there is a great deal of debate on whether or not swap is still necessary nowadays, but it’s recommended that you create it since it won’t take up much space anyway.

Back to the subject of partitioning, when you create a partition on a Linux disk, it is mounted to a folder. For example, if you create a 60 GB partition and mount it to the /home folder, each time you navigate to /home, you are exiting your main partition and switching to that 60 GB partition. You wouldn’t notice this because in the display the path would simply show /home, which makes the partition layout seem transparent. This is a benefit over operating systems such as Windows, which typically assign a drive letter to each partition. Instead of a drive letter, you assign a folder to a partition in Linux and it becomes part of the main filesystem tree. The first forward slash always represents the beginning of the filesystem, so you can read from /home that the folder is stored on the root of the filesystem or simply /.

The most common partitioning practice of Linux users is to create a separate partition for /home. With such a configuration, you can format and reinstall the distribution in the main root partition without erasing files and settings as long as you don’t accidentally format the /home partition. This allows you to move from one version of the distribution to another while retaining all your data in the process. Otherwise, if you put everything into a single partition, you would have to manually back up all the files and settings prior to the installation of a new version. To help establish this point, consider the following scenario.

Joe has a 500 GB hard drive with 465 GB of usable space. He creates three partitions: the first partition is 40 GB; the second partition is 16GB; and the third partition he creates uses the remainder of the disk, which would be about 409 GB. Joe assigns the first partition to /. The second partition is dedicated to the swap area. Finally, he allocates the third partition to /home.

When Joe installs Linux Mint, the distribution is installed to the root partition or simply /. During the installation, he clarifies that he would like the 409 GB partition mounted under /home. Later, Joe decides to install a new version of Linux Mint. During the installation of the new version, he tells the installer that he would like to format / but not format the 409 GB partition, which belongs to /home. Since Joe chose not to format /home, all the files and settings he has stored there will remain intact even though he erased and reinstalled Linux Mint.

If Joe installed the distribution with a single partition instead, he would not have had this luxury. Since there would have been only a single partition, his only option would have been to reformat that partition, which would have erased everything on it. This means that he would have had to manually backup and restore his files. Dedicating a partition to /home is a major convenience that should not be overlooked.

When partitioning, it’s recommended to allocate at least 30 GB to /. Linux Mint does not necessarily need 30 GB to be installed. In fact, the default installation may just take somewhere around 2 GB. As you use Mint, install programs, and run updates, you’ll find that the installation will grow and take up more space. In most cases, 30 GB is more than enough to work with.

As for swap space, a good rule to follow is to create your swap partition of the same size as the amount of RAM your system has, plus an additional space of 1 GB. In practice, it’s not uncommon to see Linux users omit the creation of a swap partition since RAM is extremely cheap, and the likelihood that you will run out of RAM while using your Linux installation is small on systems with the luxury of a lot of memory. However, it’s important to point out that laptops utilize swap while hibernating (suspending to disk), so if you plan on using the hibernation feature, creating a swap partition is mandatory. Some programs may use swap space even when RAM isn’t full, so omitting a swap partition is not recommended.

Finally, the /home partition should be the largest as that’s where your personal data will be stored. If you have a large music or video collection, it’s very easy to use quite a bit of space under /home. Although every Linux guru recommends different partitioning schemes, I recommend that you create the /home partition at the end with whatever space remains on your drive after the creation of other partitions. As an example, a partition layout on a 200 GB disk may look like the following:

  • Partition 1 (30 GB) designated to /
  • Partition 2 (8 GB) designated for the swap area
  • Partition 3 (162 GB) designated for /home

If you have a very small hard drive, the creation of a separate partition for /home would not make sense. For example, I recommended that you create a root partition with a minimum of 30 GB space. This wouldn’t be ideal if your entire disk was barely larger than that. If your entire disk is only something like 40 GB, you wouldn’t have much space left after allocating 30 GB for /. If your disk is small, just use the Erase disk and install Linux Mint option during the installation as you wouldn’t have enough space to work with otherwise.

Comments are closed.