Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Why is it faster to have more primary partitions when using Linux?

Please give some real examples; I know some theoretical reasons but I don't understand them well.

share|improve this question
    
Which version and distribution of Linux are you using? This may be important as different groups of developers have different priorities. –  Randolf Richardson Mar 14 '11 at 1:30
1  
[citation needed] –  Ignacio Vazquez-Abrams Mar 14 '11 at 1:46
1  
I never knew it had speed advantages... Do you have a source for this claim? –  Breakthrough Mar 14 '11 at 16:00
    
    
linuxbsdos.com/2010/10/12/… –  Yosef Mar 14 '11 at 22:11
show 1 more comment

2 Answers

up vote 3 down vote accepted

The main reason might be caching, as Linux individually caches filesystems.

Having a single drive with a single partition means, all data on the filesystem competes against each other in the cache. Hence spool-data and binaries, user files and webserver, all use this one big cache.

If bigger data transfer (downloads, streaming movies, etc.) is going on, these will virtually flush the one single cache, so often used binaries etc. vanish from the cache and must be re-read from disk - which may take a while, as large data transfers are going on, so the drive is heavily loaded!

If you have more than one partition each one is cached individually. Hence you have chances that the binaries are still cached even if the webserver cache is heavily loaded.

However this depends on the used caching strategy. As I heared there are several different cache strategies out there today, but sadly I had no time to dive into that deeper.

There also might be a second reason, however today I think this is no more similar relevant:

Maintaining larger structures in the kernel takes more RAM. In old days when there was not much RAM (say 256 MB) filesystems could go so large that you were not able to fsck them without enabling swapping. Today this usually is no more of any issue.

However larger structures need more frequent flushing of pages. Smaller partitions have smaller structures, so the likeliehood that more frequently used parts are still present in the kernel are higher.

You even were able to see this on nearly idle systems in the old days, as these were not able to keep everything in memory even without having larger disk accesses.

But today with virtually enough memory I don't think this is of any importance.

A third reason might have to do with elevators, say how Linux accesses data.

Linux tries to re-arrange disk access, such that the drive's head works more or less like an elevator which tries to use some optimized path going up and down.

Keeping similar data close together can improve access, as then you can read in portions of those requested information in a more predictable way. So access to partitions like /usr/ improve when this information is kept close together.

However this, too, gets more and more unimportant today, as the emerging solid state disks do not have physical drive heads, so seeking time more and more becomes unimportant.

Expiry note:

With the upcoming of all those new filesystems like BTRFS and ZFS all the discoveries of the last 30 years or so on clever partitioning become void. These filesystems do not have any notion of "partition" anymore, so I think partitioning your drive is something that will become more and more obsolete.

Already today with LVM you no more simply partition your drive, instead you map the volumes dynamically somewhere else. Volumes may be broken up into several parts, and it might even get distributed over several disks. And enterprises often use SAN, where you do not have something like a real physical disk anymore (from the computer's perspective).

So it is true, that with some certain applications (database raw devices) your disk setup might be somewhat important to improve access speed. However except for such rare cases it is not worthwhile to try to find a super-clever-all-time-best-and-perfect partitioning scheme, as this will only speed up things in a low % area, if you notice any effect at all.

Properly laying out your application (Grid computing etc.) offers far more speed improvement possibilities. Or to speak for the consumer market:

Don't buy your Computer where you buy apples (those you eat). With only a few $ more you often can get a system which is faster and often less power hungry - which will pay out on the long term.

So stick to any partitioning scheme you like and just buy a little more clever - this will improve performance most ;)

share|improve this answer
    
That "expiry note" is wrongheaded. The data structures dividing up the disc changing from (say) the MBR partitioning scheme's data structures to LVM's data structures does not affect the fact that the disc is still sliced into bits; and therefore the considerations like the head seek time between different parts of the disc platter(s) still matter. Slicing into slices with LVM or with EFI partitioning or with MBR partitioning doesn't affect the fundamentals. Partitioning is not becoming "obsolete". It's simply being done with different data structures. –  JdeBP Mar 18 '11 at 14:15
    
I agree that partitioning (LVM layout, etc.) never will become completely obsolete, as in many cases it's just the simplest thing you can do. So perhaps I should have written "less important" instead. What I wanted to express is, that instead wasting days in finding the perfect partition layout, speed can be improved "cheaper" by buying an SSD drive or adding an additional mirror drive. So finding a "reasonably good" partitioning is enough, no need to worry that it is not perfect. And things will change a lot when you switch to ZFS etc. –  Tino Jul 23 '11 at 19:26
    
One important thing to note here on partitioning: A proper alignment of partitions is very important, especially for SSD. Nowadays with modern disks which have more than 63 sectors per track the default MSDOS/XP scheme to place the first partition at sector 63 (aka. cylinder 0 head 1 sector 0) nearly is always wrong, especially for SSD where alignment to the SSD's page size is crucial. Keep that in mind for partitioning schemes. –  Tino Aug 14 '11 at 13:19
add comment

There are many things that can benefit performance when you divide your disk in many partitions instead of having all your files stored in one big partition. Some reasons are:

  • outer cylinders yield a higher transfer rate than inner cylinders. So if you put your most accessed files in a partition covering these cylinders, they will be recovered faster. Or, if you want a faster boot, put your system partition in these cylinders.
  • Separating constantly changing folders (/tmp, /var, /home) from system folders (/, /usr), that is, put them in separate partitions may prevent fragmentation of the system files (for example, when you do a system upgrade) and thus guarantee you will keep having a good performance for system and applications startup.
  • Considerations about which files are more frequently accessed and placing them in partitions located near to each may yield better performance due to less head movement.

So, more than just "More primary partitions is better" you should consider that a good knowledge of how your system will be used and puting that knowledge to good use in planning the partitioning of your disks may give you better performance.

share|improve this answer
    
Of course, with modern SCSI and ATA disc drives from the past decade and a bit, one doesn't necessarily know where the "outer" and "inner" cylinders actually are. Disc units are permitted to map logical block addresses (and the logical disc geometry) onto the physical disc geometry as they see fit. –  JdeBP Mar 18 '11 at 14:09
add comment

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.