Deciding How to Partition the Drive for Linux

As described in a separate post, I was installing Linux Mint 17.3. The installation process presented me with the question of how I wanted to partition the system drive. On one hand, it was possible to install Mint, and other Linux distributions, with only one or two partitions: root and perhaps swap. On the other hand, various sources cited reasons to create one or more additional partitions. The following paragraphs discuss those options and present my conclusions. (Based on remarks by How-To Geek, MakeTechEasier, and UnixMen, in this post, all Linux partitions except swap used ext4 format.)

Root. The essential root partition was commonly designated with the simple forward slash, “/”. This was much like the Windows drive designation (e.g., C:), representing the top level of the Windows file system on a given hard disk (HDD) or solid state (SSD) drive. Subordinate directories (i.e., folders) (e.g., /home, /var) would appear under root. Unlike the situation with Windows, however, those folders could be placed on their own partitions, and yet would still be represented as being subordinate to root. For example, in Windows, if I moved the C:\Programs folder to drive D, it would be referred to as D:\Programs. But in Linux, I could put the /home folder on its own separate partition, and it would still be called /home, indicating that it was still a logical part of (i.e., still subordinate to) the / partition.

There was a question of how large / should be. According to a How-To Geek webpage, the root partition, holding program files, probably wouldn’t need to be larger than 20GB “even if you install a ton [of] software.” But an Ubuntu community page on DiskSpace warned that the root partition should be at least 15GB, and said, “Warning: your system will be blocked if the root partition is full.” Apparently, at least in some situations, it could be difficult or impossible to increase the size of root later. Others recommended 30GB. MakeUseOf recommended 50GB or more, for those who planned to install many applications or games. With today’s HDDs commonly running to 1TB and larger, and with the ability of backup software to compress a drive image to a minimal size — and with experience with Windows installations requiring 50GB or more — an allocation of 50GB for the root partition did not seem excessive. I assumed that a user who allocated 100GB was storing data files on that partition, but I did not expect to do that (see below).

Swap. The other partition (essential in at least some distributions) was /swap. The swap partition served a purpose similar to the Windows paging file: it would hold material that was in active use but couldn’t fit into RAM. A How-To Geek webpage said the swap partition should be about 1.5 to 2 times the size of RAM, and should be located at the beginning (inside edge) or end (outside edge) of a hard disk (presumably location would not matter for an SSD). (That overruled other sources, speaking of very old drives, on which it would be better to put the swap partition in the middle of the drive.) An Ubuntu community FAQ page could be roughly summarized as suggesting that swap should be at least as large as RAM if you use hibernation, should be no more than 25% the size of RAM if you don’t use hibernation (unless you have less than 12GB of RAM), and should not be more than twice the size of RAM in any case. The How-To Geek webpage noted the possibility of optimizing performance by putting root on one drive (e.g., an SSD) and putting swap and home on another drive. But performance would doubtless be much more enhanced by putting everything on an SSD; and at this point, with dropping SSD prices, that was becoming increasingly feasible.

Boot. A separate /boot partition would apparently never be harmful. It would be advisable if not necessary for certain complex installations. An Ubuntu community DiskSpace page said that some computers or drives would require separate /boot, BIOS-boot, and/or EFI partitions. Some really old hardware would also apparently require a boot partition.  A search led to multiple comments identifying other potential advantages of having a relatively small (perhaps 100MB to 250MB, ext3 or ext4) boot partition. A separate /boot partition was recommended if not essential for dual-boot setups, though for some distributions the installer was now able to set up a dual boot with Windows automatically.

Var and Tmp. Some recommended creating /var and /tmp partitions of perhaps 5GB each. The rationale was that these directories would contain log and temporary files that could grow quickly and substantially, filling the root filesystem and potentially locking the system. I was not sure whether that would be likely on a desktop system as distinct from a server. It appeared that some distributions (e.g., RedHat) would automatically clean at least the /var/tmp subfolder, and one discussion seemed to indicate that, starting with Ubuntu 14.04, the /tmp folder was cleaned automatically; but otherwise it could be up to the user to do a manual cleanup, or to schedule an automated process to take care of it at certain times or at regular intervals. Among such processes, as of an unspecified date, the tmpreaper package and an autocleaner script did not appear to be a part of the default Linux Minut installation. It was not clear whether putting /var and /tmp into separate partitions would prevent the system from freezing up, if those partitions filled up. It was also not clear that doing so would reduce the size of drive images: some comments seemed to indicate that files remaining in those folders could be needed for stable functioning of the system or of specific software packages. In that case, I would want to include them in the image. I concluded that the best practice would probably be to understand what I could delete from these folders, and when I could safely delete it, without the additional complexity of putting them into separate partitions.

Home. Sources (e.g., 1 2) differed on whether it was advisable to have a separate /home partition. A Guide to Linux for Beginners said that doing so would make it easier to reinstall the same or a different Linux. WinAero said, “You can unmount the /home partition and perform system maintenance without risk of data loss. You can even reinstall the operating system and format all the other partitions and keep your /home partition with all your data and app preferences intact!” Of course, the user could also restore a drive image containing everything in or under root, including the /home folder. Since I expected to use the home partition only to store configuration information, not data files (e.g., music files, documents) (see below), sources (1 2) said just a few GB would suffice. According to izx,

The biggest pro [for having a separate /home partition], in my opinion, is that you can easily install a newer Ubuntu version (or any Linux distro for your architecture, really), without losing most of your custom settings, configurations, downloads, etc., since such a step usually involves wiping out the existing system/boot partitions. You simply choose to preserve your /home in the partitioner during install, and you’re set. It is also possible to do this with /home on your / partition, but is a little more complicated.

In the interests of simplicity, I decided to go for the separate /home partition. I was encouraged in this direction when I reinstalled my system, later, and found that the simplest instructions did involve a separate /home. Originally, I thought a 10GB /home partition would suffice, but later I changed that to 20GB.

DATA. While the traditional approach seemed to be to use /home for data files (e.g., documents, MP3 files) as well as for configuration data, I was persuaded by those (1 2) sources who argued in favor of having a separate DATA partition for data files. For one thing, I wanted my data files clearly separated from configuration files. Also, this DATA partition could be formatted as NTFS. That would make its contents visible to Windows as well as Linux — which would be useful if I wound up installing a Windows dual boot, or networking this machine with a Windows machine, or swapping out this drive to a Windows machine. Keeping data separate from system files would also let me back up the two on different schedules. I did not expect to back up my operating system as often as I would back up my data, because the operating system saw fewer significant changes. Depending on the option of adding other data drives, I planned to use this DATA partition to fill perhaps half of the remaining space on the HDD. If the Linux installer did not permit creation of an NTFS partition, it might be possible to designate this partition as unused space during installation, and then to revisit it later with a partitioning program like GParted.

BACKROOM. On my Windows installations, I had found it useful to have a separate, unencrypted NTFS partition that I named BACKROOM. Generally, this partition stored materials that did not need to be included in image or data file backups. That would include drive images themselves. Since the partition was unencrypted (whereas the DATA partition, above, might be encrypted), I could boot a USB drive and restore those images, from this partition, without having to run encryption software to access them. On Windows machines, I also used this partition as a place for cache files that did not need to be included in my image backups of the operating system. Examples of caches that could apparently be relocated in Linux included the Google Earth cache and browser caches. I suspected it would also be possible, in Linux, to relocate some other caches (for e.g., video editors and file content indexers), as well as Firefox Session Manager session backups.

Other Partitions. The Ubuntu community DiskSpace page also listed a number of other possible partitions that could have advantages in special situations. There could be limits on which of these would be practically available. For example, the Linux Mint 17.3 Xfce installer allowed separate mount points for only the partitions mentioned above plus /usr (or /usr/local), /srv, and /opt.

ConclusionBased on the foregoing discussion, I planned to create a 250MB boot partition, a / partition of at least 30GB, a swap partition whose size would be determined by the several factors mentioned above, and to divide the rest of the disk between DATA and BACKROOM (NTFS) partitions.

This entry was posted in Uncategorized and tagged , , , , , , , , , , , , . Bookmark the permalink.

One Response to Deciding How to Partition the Drive for Linux

  1. jsarnofff says:

    This is very helpful. Thank you.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s