Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

While installing Ubuntu with the "something else" option, I found out that there are many folders that can be mounted on separate partitions, as you can see in the image below.

many folders can be mounted on separate partitions

So what are the advantages and disadvantages of mounting these folders(or directories) on separate partitions?

Specifically the directories are

  1. /boot
  2. /home
  3. /tmp
  4. /usr
  5. /var
  6. /srv
  7. /opt
  8. /usr/local
share|improve this question
    
possible duplicate of How to understand the Ubuntu file system layout? –  Charles Green Aug 26 at 16:27
6  
@CharlesGreen That question describes the use of these directories. I'm interested in knowing the advantages and disadvantages of mounting them on seperate partitions. So these questions are not same. –  Registered User Aug 26 at 16:31

5 Answers 5

up vote 25 down vote accepted

Long long time ago...

... There was a time when people used to install Linux and configure it by hand for their specific needs. Some of this is true even today for servers. The choices you see in gparted are some of the popular ones for those who had very different needs as compared with the average desktop users, the intended audience for Ubuntu desktop.

Let us take these one at a time. I will skip the ones I don't know much about.

  1. /boot there was a time when the Linux file system was fragile and hard drives were small. People were afraid that the hard drive would fill up or get corrupted and Ubuntu won't boot. Keeping the kernels in a separate partition helped the system to boot when other things went wrong. In those days Linux users used to compile their own kernel and clean up old ones. These days I find it a bit counter productive. On a desktop that gets all the updates, a small /boot partition tends to get filled up with old kernels and the system stops booting unless one cleans it periodically. See what happens if you have a separate /boot partition and forget to clean it regularly: How do I free up more space in /boot?
  2. On the other hand, if you want to encrypt the / partition (to safeguard the secret software you are working on), you will need a separate (and unencrypted) /boot partition. Otherwise the system won't boot. Similarly, if you have a RAID drive, keeping /boot in a non-RAID partition may be useful. Many people thinks having a separate /boot partition is a very good idea for these and other reasons.
  3. /home Keeping home in a separate partition still makes some sense. This folder/partition has your personal files and having it in a separate partition allows you to format / and reinstall Ubuntu while keeping your files untouched. Recent versions of the Ubuntu installation software includes a choice of update from DVD/USB. This option keeps /home intact even it it is not on a separate partition. If you run out of space in your primary drive with / partition. You may want to add a new drive and create a single /home partition in the new drive.
  4. /tmp is where temporary files go. If you are running a server that creates large temp files, they may fill up all the disk space and bring your server to a halt. Keeping it in a separate partition will only fill up that partition and may stop the process that was creating the big temp files but will not stop the rest of the system. I am told it is easier to deal with a filled up /temp partition than a temp folder under / partition.
  5. /usr/, /opt/, and /usr/local are all places where programs and apps are kept under different conditions. If you develop software for Linux, it may make sense to keep these in separate partitions, so that if you reinstall Ubuntu, you won't delete the programs you have written or have been working on.
  6. Keeping /opt/ and /usr/local in separate partition also makes sense if you install programs from source (your own or from somewhere else) and want to use them in another distribution (say Red Hat) installed in the same computer in its own partition. Then both the distributions, Ubuntu and Red Hat can share the /opt and /usr/local partitions. (Thanks Rmano!)
  7. /srv and /var are particularly useful as separate partitions if you run servers or develop web pages. For the average desktop user these folders don't take up much space and does not hold anything that is of value to the user. For a web developer losing /var/www may mean losing her job.

To be sure, these are not the only directories one can mount as partitions. In Linux, one can mount a partition as any folder anywhere. Partitions are often mounted as sub-directories of /mnt/ and /media.

Hope this helps

share|improve this answer
    
+1, nice answer. You can also see my take in askubuntu.com/a/379212/16395 and askubuntu.com/a/379019/16395 –  Rmano Aug 26 at 18:06
1  
Thanks @Rmano I had seen your detailed answer before. I will borrow from your second answer and edit mine. –  user68186 Aug 26 at 18:16
2  
It's ok (although I do that to make them survive a complete reinstall --- newer installers are able to save /home but not /usr/local. BTW, "install by hand and tailor" is the Arch Linux lemma... so there are still (a lot) of people doing that. –  Rmano Aug 26 at 18:39
1  
The historical reason of having /boot as a separate partition is from the days that harddisk was larger than the BIOS could handle so if the kernel was in the inaccessible part of the disk it could not be loaded. By putting the /boot partiton first on the disk it was ensured that the BIOS could always access the kernel so Linux could boot. –  Thorbjørn Ravn Andersen Aug 27 at 23:11
1  
Also note that disks could be added to get more space, but in Unix you need somewhere to mount them instead of just assigning a drive letter. For instance if the disk ran full, a new disk was bought to hold /home and the current contents moved there. –  Thorbjørn Ravn Andersen Aug 27 at 23:14

Generic advantages of having multiple partitions:

  1. You can use different disks/LUNs and have better performance. This can increase the performance of the databases as you can have the transaction log on a storage and the data files on another. Similar for disk I/O intensive web applications.
  2. You can use different mount options (that increase the security or that affect the performance or stability in a more granular way)
  3. You can have different filesystems
  4. You manage the space separately. So you can have a nasty application that fill the space that is not affecting other applications.
  5. Fragmentation of one partition is independent of the other.
  6. You can snapshot, mount, umount, format, defragment, monitor for performance of those file systems independently.
  7. You can have encryption on specific volumes.
  8. You can mount volumes on demand.

Generic disadvantages of having multiple partitions:

  1. It increase the administration overhead.
  2. You will have greater chances to waste more disk space.
  3. You will have more incidents involving disk full.
  4. It is more difficult to create a consistent snapshot of an application running on different volumes.
  5. It uses slightly more resources.
  6. Depending on the volume type (MS-DOS label, LVM, btrfs...) you might not be able to easily allocate space from a volume by shrinking another. Especially online.

Another way to partition your system is to use LVM, btrfs or zfs for /. Allocate just the minimum space for / and when needed create logical volumes or extend /. This leaves you the choice to split in volumes at a later time and has lower maintenance costs.

Now specific stuff:

  • /boot is good to be a separate partition. The file system must be one supported by your boot loader (usually GRUB).
  • If you use EFI/UEFI it is a requirement to have a EFI system partition.
  • /home is good to separate the user stuff from the OS and applications.
  • /tmp can be mounted with noexec, nodev, nosuid. It can be a memory mapped fs like tmpfs.
  • /usr can be mounted read-only and only remounted rw for updates, it can be remote like a NFS share.
  • /srv /opt will store the application and application data. If you have an I/O intensive application you can use better disk subsystem (eg SSD)
  • /usr/local is the default used by applications installed locally on the current machine. For example you have everything else on NFS and have a local disk...

There is no perfect solution. If you have no clear reason why to create a new partition, then don't. The only partition you might need to create besides / is /boot.

For desktops/laptops is nice to have /home so that you can reinstall the OS independent of your data.

share|improve this answer
    
Yes, thank you. I will edit to clarify ;) –  Mircea Vutcovici Aug 26 at 18:18
    
You are welcome. I don't agree that it is a good idea to have a separate /boot partition for average desktop user. The old kernels don't cleaned out automatically, and new ones get added. Then this happens! –  user68186 Aug 26 at 18:33
1  
If it gets full the user will not be able to install newer kernels and updates will fail. But the system will be functional. –  Mircea Vutcovici Aug 26 at 18:39
1  
On the other hand if you are using a file system not supported by GRUB or you encrypt the / partition, you must use a /boot partition. –  Mircea Vutcovici Aug 26 at 18:40
1  
I've edited my answer to remove the mandatory requirement of /boot partition. –  Mircea Vutcovici Aug 26 at 18:42

For desktop?

No difference.

For server?

Space management and backup.

If your system have many users you can make additional partition for /home/, then users will not exeed that space and root (/) will not be affected.

You can also mount NFS, SMB or partition on other physical disks on those folders. For example :

/dev/sda1 /boot (1GB)

/dev/sda2 / (60GB)

nfs://IP/folder /home ( X TB )

/dev/sdb1 /var (1TB for /var/www or /var/ftp)

For laptop

/ on m-sata (fast)

/var /home /opt /tmp on hdd (slow)

share|improve this answer

przemo's answer, imo, most closely hits the practical points. Here are some additional practical considerations:

Enterprise environments typically use separate partitions for at lease / , /home , /opt , /var , /boot , and additional filesystems (1 per application or application team) under /opt. This is primarily to avoid running the system out of space because of someone home directory getting massive (/home), logs going out of control (/var), or apps consuming tons of space (/opt , /opt// , etc), and /boot so that the other partitions can be built in LVM and also to ensure you can get something of a recovery shell should the primary system partition become corrupt for some reason.

For my own personal non-server uses, I just keep separate / , /boot , and /home partitions so that I can dual boot multiple Linux/UNIX OS's and use the same /home partition for them.

In the case of building a VM in Oracle Virtualbox, VMWare Player/Workstation/Fusion, etc for personal use, there really is no practical reason to have multiple partitions with different mount points on account of the nice folder sharing capabilities provided by at least VirtualBox and VMWare Player/Workstation/Fusion. The single exception might be /boot for the recovery shell reason given in my "enterprise environment" paragraph.

share|improve this answer

If something goes really wrong during update or major version upgrade, having /home on a different partition allows you to boot from CD and then wipe completely and reinstall the operating system without losing your data. Also, this makes multiple boot with various Linux distributions possible, some people like to evaluate these side by side.

share|improve this answer
    
Separate /home is one of my soap boxes, but I still got burned recently when I installed saucy in another partition just for testing on an oneiric notebook and it messed up a bunch of configuration files in my shared /home that made oneiric very unhappy when I rebooted into it. –  Joe Aug 29 at 7:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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