Partitioning and disk performance

Discussion in 'all things UNIX' started by Gullible Jones, Jan 21, 2013.

Thread Status:
Not open for further replies.
  1. We all know that filesystems get fragmented with use, and that smaller filesystems are quicker to access. So it makes sense to have separate partitions for /, where your system files are, and /home, where your data is. Fine.

    There may be advantages to more elaborate partition layouts, e.g.

    - Using secure mount options for world-writable areas may help avoid certain exploits (though this is probably more applicable on multiuser systems than desktops)

    - Prevention of various failures due to logs or temp files getting too big

    - Further prevention of fragmentation, if using a separate /var partition

    However, I'm wondering if the performance impact is largely beneficial or detrimental, regardless of fragmentation issues.

    My reasoning here is that modern Linux filesystems are mostly journaled, which means metadata is written to the disk twice. And more partitions with journaled filesystems = more journals, which (I expect) should mean the drive heads moving around more during writes. Which should mean delays, right?

    But I'm not sure how this balances with the shorter access times for smaller filesystems...

    I lack the inclination to benchmark this stuff on my desktop, so I figured I might as well ask here: what impact do different partitioning layouts have on Linux performance, on a machine with a typical SATA HDD? How about for random vs. sequential loads? Read vs. write performance?
     
  2. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,331
    Location:
    West Yorkshire, UK
    Smaller filesystems are not automatically faster.
    Lower freespace can increase rate of fragmentation due to less contiguous spaces to place files.

    Both XFS and EXT based filesystems group files near each other based on the tree structure which will mitigate partitioning structures effect.
    Both these file systems heavily cache reads and writes which can mitigate a LOT of performance issues.

    Modern drives vary in density, from outer to inner so for sequential reads/writes the performance will be faster on the outer tracks.
    But the question is which files are best to put on the faster parts, most accessed, what is the head-seek impact ?

    How much slower will the fragmented files access actually be ?
    How much will that slower will your day to day tasks be due to this fragmentation ?
    When I tried testing performance loss of real world applications under Windows, after 1 month of day to day use the average performance difference was less than the performance variation between multiple benchmark runs.

    Further reading:

    https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout
    http://oss.sgi.com/projects/xfs/papers/xfs_filesystem_structure.pdf

    Cheers, Nick
     
    Last edited: Jan 21, 2013
  3. Wow thanks, there's a bunch of myths dispelled.
     
  4. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,331
    Location:
    West Yorkshire, UK
    If you want to see how much fragmentation your EXT* partition has, use the following command:

    fsck -nvf /dev/sdbX

    Replace sdbX with your drive/partition.
    In my case my root partition has 0.1% (47% full) fragmentation (since Ubuntu 12.10 was launched. My home directory that has about 5 virtual machines and various downloads is 3.1% (40% full) and lots of data files.

    Cheers, Nick.
     
  5. Nanobot

    Nanobot Registered Member

    Joined:
    Jun 23, 2010
    Posts:
    238
    Location:
    Neo Tokyo
  6. NGRhodes

    NGRhodes Registered Member

    Joined:
    Jun 23, 2003
    Posts:
    2,331
    Location:
    West Yorkshire, UK
Loading...
Thread Status:
Not open for further replies.