Why create many partitions?

29

10

I have noticed that when installing Ubuntu some people create multiple partitions for directories. Like one for root, one for home, one for boot. What is the advantage to doing this over installing them all on one partition, assuming there is only one hard drive?

ryeguy

Posted 2009-08-26T19:49:35.663

Reputation: 671

Answers

36

There are several reasons:

  1. System robustness. If you have /home on a separate partition from /, then a regualr user can't fill up the / filesystyem, making it unusable for the rest of the system.
  2. Backups. It makes it easier to back up entire partitions, and to back up on different schedules. For instance, you might only need to do weekly backups of the system partition, but nightly backups of the /home filesystem
  3. System installs. You can have the same /home filesystem mounted by several different system images. And you can delete and rebuild / with out doing a backup/restore of /home or /local
  4. Disk optimization. Not as much of an issue with todays fast drives, but it used to be common practice to put the system filesystem on the inside tracks of the disk to speed up access
  5. Using multiple drives. Before the common availability of large drives, it was common to have little room on the system drive. So a separate drive was used for /home.
  6. NFS. When sharing data across multiple systems, it is common to do it on a filesystem basis.

KeithB

Posted 2009-08-26T19:49:35.663

Reputation: 8 506

4+1. Also security. You can set /boot to be readonly or /tmp to be noexec, for example. – DaveParillo – 2010-02-08T21:05:14.100

I don't see why separate parts help with backup; you can just as well backup folders separately. Could you explain? – sleske – 2010-04-02T03:28:07.670

2@sleske This is a historical artifact of the original Unix dump and restore commands, which would only work at the filesystem level. I ran into this when tape drives used 1/2 inch (I think) tapes on 1 foot diameter reals, in a drive about the size of a refrigerator. With some iron fillings, you could actually see the bits on the tape. – KeithB – 2010-05-13T15:57:15.000

Thanks for the info; I wasn't aware of that. I hope there's not too many shops that still backup using dump though... . BTW: Fascinating stuff about the old tapes :-). – sleske – 2010-05-16T17:27:44.020

Also stability. If you put /var on a separate partition, then log files that grow out of control won't fill up the rest of the drive (and potentially bring down the system). (edit - Just noticed Adrien pointed this out below. :) – Charles Burge – 2016-10-25T00:40:53.813

11

I typically create one for root, one for swap, and one for home. The advantage of this is that it allows you to leave your documents (also music, video, pictures, etc) untouched if you need to reinstall the OS. Because you can completely over write the OS partition (root) without touching the home partition, your files are safe and there is no need to perform the time consuming process of transferring them to another media and then back to your fresh machine. It makes reformatting/imaging much more elegant

Here is some more info on the benefits. Although its written about windows, the principle is the same.

Mike M

Posted 2009-08-26T19:49:35.663

Reputation: 730

1I also like to have /boot on it's own partition – DaveParillo – 2010-02-08T21:02:45.933

6

Having /var and /tmp on separate partitions are also generally considered good ideas; that way, if a log file (for example; any temporary file) spins out of control, it will be stopped before filling the entire disk.

Adrien

Posted 2009-08-26T19:49:35.663

Reputation: 1 374

3

I used to overdo the Partitioning thing in my good old windows days because I thought it might be more clear. One drive letter for a certain topic (e.g. Music, Pictures, Work etc.). But even there separating your data and the system already made sense: Should the system crash you can just format you system partition and reinstall without losing all your data.

Unix like systems and Ubuntu don't have drive letters, partitions just get mounted in any empty folder. So the thing that actually makes sense in my eyes is:

  • Create a system partition for the actual system installation
  • Create a partition for your home directory. Easy to backup and since almost all programs keep the settings there you can reinstall/upgrade your system without losing much in a short time.
  • Create a swap partition (usually works better than a swap file)
  • As Babu already said create a boot partition if the Bootloader doesn't support your systems partition format.

Imho more than 4 separate partitions don't make sense in Ubuntu (4 is the maximum number of primary partitions you can create) - it's just a matter of personal preference.

Daff

Posted 2009-08-26T19:49:35.663

Reputation: 675

3I have seen indeed some people making a partition for each kind of data. The big problem with that is mostly that you can never calibrate correctly the size each will need. And sooner or later, you will start putting files in the wrong partitions, lacking space in the appropriate ones. So in general, "don't use partitions where you can use folders" – Gnoupi – 2009-08-26T20:03:33.513

1Exactly... you can use the available space way better with one partition and a good and clean folder structure. – Daff – 2009-08-26T20:38:38.700

1

A separate /boot partition allows me to boot and repair my root file system, even if the root file system is corrupt. If I put all the boot files in the root file system, and it gets corrupted, it might not boot at all. There is also more flexibility. Later, I can put a second disk in, put swap on that, and delete the swap partition from the root disk and expand the root filesystem into that space.

Creating a hard swap partition instead of one in the filesystem, is just UNIX-style sysadmin. There's no real reason not to make it just a file in the filesystem, except that some user will come alone with sudo powers and try to rm it.

As Babu and Mike said, a separate /home allows me to update or change distros without losing all my data.

kmarsh

Posted 2009-08-26T19:49:35.663

Reputation: 4 632

0

Keeping a separate home partition lets you keep your files should you reinstall your linux distro.

GRUB doesn't support ext4, so if you're going to use that filesystem for the rest of your files, you'll need a separate boot partition. GRUB now supports ext4, so keeping a separate boot partition, while still an option, is no longer necessary.

Babu

Posted 2009-08-26T19:49:35.663

Reputation: 1 297

grub (legacy) has ext4 support https://launchpad.net/ubuntu/jaunty/+source/grub/0.97-29ubuntu47 and so does grub2 https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/294763 (note the "fix release" status)

– richq – 2010-04-01T21:17:56.773

ah, the joys of keeping old posts up to date.... – Babu – 2010-04-02T02:30:29.563

0

Keeping the home directories on a separate partition prevents the users from accidentally filling up the root partition. This is good because if you fill up the root partition, you end up with problems (system logs, for instance, are often in the root partition).

While it's not actually possible for non-root users to use the last bits of space on a disk (the system won't let them), it is possible for them to fill it up most of the way, and then for automated system processes to finish the job, making it annoying to get everything back into operation.

Michael Kohne

Posted 2009-08-26T19:49:35.663

Reputation: 3 808

-2

Linux generally sees the disk very differently than a Windows machine. Also Windows Fat32/NTFS and even newer file systems are mostly a Windows strictly format. So you don't actually know what they do or how they behave internally. Linux uses its own file systems ext3/4 being the most widely used, the Linux file system doesn't exist in a tree like state nor does it treat data like a second class citizen residing on your disk. The reason you can create single or multiple partitions for the os is both for organization and disk speed access. Though this last part has changed over the years, most Linux users don't bother with multiple partitions because you need to slice your os data to fit evenly over the partitions you manually create. I personally find it counter intuitive to have multiple partitions. On the other hand Linux machines don't generally suffer from bad disk sectors or having an auto feature for defrag. This is just bad design by Microsoft, can't fix their internal issues so they build tools that allow you to fix your own problem 60% of the time anyway.

Dawg

Posted 2009-08-26T19:49:35.663

Reputation: 1

"doesn't exist in a tree like state"? "treat data like a second glass citizen"? "linux machines don't generally suffer from bad disk sectors"? This is pretty much all nonsense and what does fragmentation have to do with anything? – psusi – 2016-10-25T01:53:24.493

"I personally find it counter intuitive" -- Honestly, you have a lot of misconceptions about, well, pretty much everything. This may all make more sense to you if you do some basic research. Don't be afraid to ask your own questions here to gain a better understanding. That's what the site is here for. Post answer on the things about which you have a thorough understanding. The site is a knowledge base, and "knowledge" is really a key word when it comes to answers. We peer-review each others' posts, so incorrect answers usually get dinged (like this one). :-) – fixer1234 – 2016-10-25T05:25:51.280

BTW, there's a lot of good explanation in the other answers, so that's a good place to start learning. – fixer1234 – 2016-10-25T05:31:29.787