9

I've just installed Ubuntu recently, and according to suggestions online, I created my home directory much larger than the root directory. However, I found that the system automatically installs software in the root directory, which takes up a lot of space, and my home directory is almost empty.

I'm a bit confused why it is actually created larger. Should software be installed in the home directory instead? And where should I put the folders of prebuilt binaries downloaded from other sources?

3
  • 25Gb for / is more than enough unless you intend to use it as server.
    – Rinzwind
    May 21, 2017 at 16:03
  • @Rinzwind: Depends… if you install a bunch of games in /opt or /usr/local or even in /usr (think 0 A.D. from the repositories) you can fill 20 GB very quickly. May 21, 2017 at 19:55
  • Could you please tell us to to which suggestion(s) you're referring in your question? They seem sensible for the majority of Linux desktop systems (see above) but they may be wrong or you may have misunderstood something and it would help to see where this disparity between expectation and reality comes from. In any case you can always resize or even merge file systems and partitions. May 21, 2017 at 20:05

3 Answers 3

8

Before directly answering your question, it's important to be clear on the distinction between a directory and a partition. A single partition can hold multiple directories. In Linux, partitions that hold filesystems are normally mounted (made accessible) using a directory as a mount point. Thus, /home could be simply a directory on the root (/) partition or /home could be the mount point for a separate partition. Your question uses the word "directory" in a context that makes it clear you meant "partition." I'm clarifying this distinction because this distinction is important to part of the answer to your question. In fact, there's yet another complication, because logical volume manager (LVM) enables a partition to hold multiple filesystems that are mounted at different places. For the below, though, I'll assume you're not using LVM, so that "partition" and "filesystem" can be considered synonymous (except for the swap partition).

The optimum sizes of various partitions depends on what you expect to install to them. For instance, with separate root (/), /home, and swap partitions, but no other (Ubuntu) partitions:

  • If you install a lot of software, you'll want a larger root (/) than if you install little software. Even so, the demands of software packages seldom exceed about 30 GB.
  • Some non-software goes in root (/). This category includes log files, databases (which normally go in /var), content for Web servers, and the system-wide temporary directory (/tmp). If you have big needs for any of these things, you may need either a bigger root (/) partition or to split off the location of these big directories to their own partitions. You might split off /var, or a subdirectory of it, to its own partition if you expect to be storing huge files there, as might be true on some types of network servers. Such non-software demands on root (/) are typically modest for desktop systems, but they can be significant for network servers.
  • For a typical desktop computer, the space consumed on root (/) won't go up very much over time, because personal files don't go there -- just program binaries, log files (which get rotated out and deleted in time), and other system files. Root (/) consumption goes up mainly because you install new software. If you install a program and then discover you're not using it, uninstalling it can be worthwhile, particularly if root (/) is filling up.
  • The /home directory is where the vast majority of user files reside. (Some temporary files go in /tmp and there are some other exceptions, though, at least one of which is very important -- see the next bullet point.) On an Ubuntu-only installation, this means that your personal photos, MP3 files, videos, word processing documents, Web browsing cache, etc., all reside in /home. Thus, the space demands on /home tend to go up over time as you use the computer -- you copy photos from your digital camera here, add music here, save word processing documents here, and so on.
  • One complication is that many Ubuntu installations are to computers that dual-boot with Windows. On these systems, most user data files reside on the Windows C: partition, not in the Ubuntu /home partition. If you continue with this pattern, the /home partition will hold relatively few files and so should probably be smaller than the root (/) partition; or it could be eliminated entirely, leaving the /home directory on the root (/) partition.

Thus, if Ubuntu is your only OS, and if you're installing on a modern hard disk or even SSD (200GB or more, and often in excess of 1TB), chances are /home should be much bigger than root (/).

OTOH, if your disk is unusually small by modern standards or if you're dual-booting with Windows and you want to keep most of your files (especially big ones) accessible to both OSes, it's probably best to either omit a separate /home partition (leaving its files in the root [/] partition as a simple /home directory) or keep a relatively small /home partition -- perhaps even smaller than root (/).

One further variant is worth mentioning: In a dual-boot configuration, experts often prefer setting aside one or more separate partitions to hold files shared between the OSes. That is, you'll have the Ubuntu root (/) and perhaps /home partitions, the Windows C: partition to hold Windows and its program files, and another partition (perhaps D: in Windows and /home/{yourusername}/shared in Ubuntu) to hold shared files. The advantage of this is that you can restrict access to the Windows C: partition from Linux, making it less likely that a bug or user error will trash the Windows installation. You'll also be able to do a full re-install of Windows without wiping the shared-data partition. You can use any filesystem you like on the shared-data partition, so long as both OSes understand it. NTFS is the most common choice for this, but you can use FAT if you don't mind its limitations; and some Linux filesystems have Windows drivers, so you could use one of them if you prefer.

With those generalities out of the way, it's helpful to consider some real sizes:

  • root (/) -- Ubuntu can install to a root (/) partition as small as about 5 GB, IIRC; however, if you start installing big programs, it can easily climb to two or three times that value. Thus, the usual recommended range is something like 10-30 GB, with the caveat that it can go even higher than that for some users -- but for the majority of "normal" users, even 20 GB is probably adequate if you have a separate /home partition.
  • swap -- I haven't mentioned swap much, but will for this question of sizing. In the old days (~15 years ago), the general recommendation was to make swap space about twice your RAM size. Today that's usually overkill. If you use suspend-to-disk (which is not configured in Ubuntu by default), swap space should be at least as big as your available RAM. If you don't use this feature, it can be smaller than that, but having some swap space is desirable, because it enables the kernel to optimize RAM use to improve performance. Note also that swap space can be a file on a filesystem rather than (or in addition to) a swap partition. (IIRC, suspend-to-disk requires a swap partition, though.) Overall, in most cases I'd say half your RAM size is probably a decent size for a swap partition.
  • /home -- As a first approximation, once you've figured out how much space you need for root (/) and swap, you should give everything else to /home. The exception would be if there's very little space left. For instance, if you're dual-booting with Windows and want to give Linux just 30 GB, then you'll have next to nothing left over by the time you allocate, say, 20 GB to root (/) and 4 GB to swap. Something similar would happen if you're installing on a tiny tablet or very old computer with a small disk. In this case, you might as well omit /home.
  • Other partitions -- In some cases, you might want other partitions for /var, /tmp, and so on. These aren't needed for typical desktop configurations, though. Smallish (~500 MB) /boot and/or /boot/efi partitions are sometimes required, too -- but if you don't already have these and your system is booting, don't worry about them. As noted earlier, you might want a shared-data partition for use with Windows. If you want most of your data to be shared in this way, you might omit /home and allocate the space to a shared-data partition. (You should not mount an NTFS or FAT volume at /home because Ubuntu relies on features not provided by these filesystems for some files in your home directory. You could mount a shared-data partition in a subdirectory of your home directory, though. If you use Windows filesystem drivers for Linux filesystems, you could also give Windows access to your Ubuntu /home partition.)

In the end, designing an optimized partitioning system depends on an intimate knowledge of your own needs, available disk space, and what's already been used (by another OS, for instance). If you stick with Ubuntu, you'll eventually figure this out for yourself; but there is no one-size-fits-all solution, so I can't simply give you a set of numbers. Even generalities like whether /home should be bigger or smaller than root (/) vary from one installation to another -- although if /home is smaller than root (/) when you follow my outline above, there's a good chance (but not a certainty) that omitting /home and increasing the size of root (/) by that amount would be best.

0
1

Software in current Linux distros tend to be really small. The reason is because the way software is packaged (using apt or rpm), all softwares shares a lot of common components.

It's different then OSX or Windows, where every software will install all the required libraries.

And today, a lot of game managers (like Steam) and development libraries (like RVM) will store data and libraries in your home folder. Additionally, probably you'll have high quality movies (around 5 GB), pictures (really big from current mobiles) and music.

I have a 1 TB hard drive. I manually partitioned: just 100 GB are for root, with just 14,0% used. In the other side (excluding swap), everything is the home folder, which is 79% full.

Additional note: The downside of this software package management is it'll require a bit more work from who is creating the installer, as some investigation about which library is used by your distro, and exact version. To mimic the way of OSX and Windows (i.e., provide the full library stack required by the app), some Linux companies (like Canonical and Red Hat) had created new software managers, like flatpack and snaps), with some advantages, like being able to be installed in different distros, use a sandboxed environment, etc.

1

How large the / (root) file system on your system is compared to the one backing /home depends largely how you (intend to) use the two. Let's look at some alternatives below.

1 Most common Linux desktop use case

The vast majority of people using Ubuntu install the base system plus a handful of applications (of non-trivial space requirements), e. g. for web browsing, media playback, office productivity, graphics editing, or software development, and store their personal user data in /home, e. g. documents, images/photos, music, or videos.

The space requirement of the former (Ubuntu itself) is easily satisfied with 20–30 gigabytes while the latter (user data) can quickly pile up, especially for multi-media content, to the range of terabytes these days.

As an example, on my system I have:

$ df -h /home ~/medien
Filesystem          Size  Used Avail Use% Mounted on
/dev/sda9           500G  264G  218G  55% /home
/dev/mapper/media   1,4T  1,1T  304G  78% /home/david/media

2 Gaming desktop

Games change things quite a bit because major titles often take multiple gigabytes or even tens of gigabytes1.

On Linux games are typically installed in one of the following locations:

  • /opt and /usr/local when installed via "custom" installers,
  • /usr when installed from a package repository2,
  • $HOME/.local/share/Steam/SteamApps when install via Steam to the default installation path, or
  • $HOME/.wine or ~/.PlayOnLinux/wineprefix for Windows games installed via Wine or its front-end PlayOnLinux.

Depending on this a Linux gamer may have different space requirements than in the above case 1.

What else?

If your use case deviates significantly from the above then you will most likely have different amounts of data in different areas of the directory tree which means different size requirements if you use more than one file system for your Ubuntu installation.

One other use I see more frequently these days is what Google's Chromebooks are geared to do: beyond a base system there is little more than a web browser and maybe a text editor, image viewer and media playback application on the system while everything else, user data as well as other applications, is stored online and accessed through the web browser.


1 On Linux that is; recent Windows titles are an order of magnitude ahead of that.

2 There aren't many spacious game titles distributed that way. The only large title I can think of is 0 A. D. clocking in at ~1.5 GB.

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.