Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 344753 - Section 4.c may yield poor performance on 4K sector drives
Summary: Section 4.c may yield poor performance on 4K sector drives
Status: RESOLVED WORKSFORME
Alias: None
Product: [OLD] Docs on www.gentoo.org
Classification: Unclassified
Component: Installation Handbook (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Docs Team
URL: http://seagate.com/docs/pdf/whitepape...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-08 20:49 UTC by kfm
Modified: 2010-11-08 22:23 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kfm 2010-11-08 20:49:12 UTC
Code Listing 3.1 in Section 4.c currently recommends that the user run:

# fdisk /dev/sda

That seems perfectly innocuous. However, the version of fdisk in the current stable version of util-linux (2.17.2) defaults to having the DOS compatibility mode on. This means that the first partition will begin at the 63rd sector (given that a sector is equal to 512 bytes). This is an antiquated practice which is required only to ensure compatibility with MS-DOS and its derivatives. Unfortunately, due to alignment issues, this runs the risk of exacting a severe performance impact upon newer drives that have a physical sector/block size of 4096 bytes, as opposed to 512. Here is a link which demonstrates just how severe the problem can be:

http://www.osnews.com/story/22872/Linux_Not_Fully_Prepared_for_4096-Byte_Sector_Hard_Drives

For a detailed technical exploration of the issue at hand, please refer to the URL on this bug.

I checked the contents of "install-x86-minimal-20101102.iso" and found that, as expected, util-linux-2.17.2 is included. It should be noted that the instance of fdisk included does recommend that the user turn off the compatibility mode immediately upon execution:

# fdisk /dev/sda

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help):

In my view this is not good enough because:

  * it's potentially confusing to the new user
  * on the other hand, it's just as easily overlooked or ignored
  * the potential ramifications of not following the advice are not made clear
    and there is limited awarness of the 4K sector issue at large

Worse, it's very hard to rectify after completing an installation (for obvious reasons). I think this is too important not to be addressed by way of instruction, so my request is that Code Listing 3.1 is changed to:

# fdisk -c -u /dev/sda

The most important thing here is the -c parameter which will turn the DOS compatibility mode *off* from the outset. This means that, when the user proceeds to create the first partition, it will begin from sector 2048 (again, assuming 512 bytes as a logical sector size). This addresses the issue for users of 4K physical sector drives, and has no adverse impact upon users of older drives. I don't know what other Linux distributions are doing, but it should be noted that Windows has adopted a similar strategy since Vista Service Pack 1.

The -u parameter is not so important but I think it should be specified anyway because it stops fdisk griping about it upon starting. Also, the unit sizes are ridiculous otherwise. It's simply more coherent to deal with a baseline unit size of 512 bytes.

Finally, please note that util-linux-2.18-r1 is better because DOS compatibility mode is now off by default. From the point of view of this bug, it doesn't matter because:

* It's not yet stable and, thus, not contained in the installation media yet
* Specifying -c is a no-op with fdisk in util-linux-2.18-r1 (i.e. harmless)

The solution I propose deals with the problem without trying to pre-empt the version of fdisk that the user might happen to be using at the time, and without requiring a detailed explanation. That said, it might not hurt to append a note. Perhaps something like:

"Note: Specifying the -c parameter is required to ensure that fdisk does not create partitions in such a way that harms performance on hard disks that use a physical sector size of 4KiB"
Comment 1 kfm 2010-11-08 20:56:48 UTC
Just to add also that it's not just the first partition which needs to be neatly aligned. Using -c will ensure that all partitions are hard aligned so as to be amenable to 4K sector drives. Needless to say, this is especially important for the swap and root filesystem partitions in a stock gentoo setup.
Comment 2 kfm 2010-11-08 21:02:29 UTC
Apologies for posting again so soon but I just noticed bug 304727 (which I didn't initially find as it has been marked as RESOLVED UPSTREAM). Spanky says that he doesn't think anything needs to be done on the part of Gentoo but, needless to say, I don't agree. In the intervening 9 months, we're still using =util-linux-2.17*. A simple change in the documentation seems merited. It is true though that newer versions have addressed the defaults, as previously noted.
Comment 3 nm (RETIRED) gentoo-dev 2010-11-08 22:23:06 UTC
Since the ~arch versions of util-linux (which will be stabilized soon) already contain the fixes, there's no point in adding anything to the handbook now and then having to revert the changes in the near future.

Also, as it is, the options won't do anything to prevent installation or usage of a system, so they will be left as-is. The fixed version of fdisk shouldn't need the flags, right? So once it is marked stable, it will line up exactly with our current instructions. In the mean time, the warnings are cosmetic, and don't impede installation.