Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

Chapter 3. Detailed Technical Notes

3.1. Red Hat Enterprise Linux 5 and 4 kilobyte sector disks

Until recently all standard harddisks had 512 byte in a sector, but as the capacity of harddisks grows, the 512 bytes per sector limitation is causing issues. To resolve these issues, harddisks with 4 kilobyte sectors are now available, and most firmware (BIOS-es, etc.) and software (operating systems) need to be modified to be able to work with these new disks.
There are 2 versions of 4 kilobytes sector harddisks:
4 kilobyte physical sectors, 512 byte logical sectors harddisk
Disks with 4 kilobyte physical sectors and 512 byte logical sectors are currently the most common 4 kilobyte sector harddrive available. These disks use 4 kilobytes sectors, but present themselves to the firmware and operating system as a 512 byte harddisk. No special support is needed for these, but care must be taken when formatting these to ensure optimal performance.
4 kilobyte physical sectors, 4 kilobyte logical sector harddisks
4 kilobyte physical sectors, 4 kilobyte logical sector harddisks require firmware and software modifications to function. This type of 4 kilobytes sector disks is currently not supported in Red Hat Enterprise Linux 5

3.1.1. Ensuring optimal performace with 4 kilobyte sector disks

When using a 4 kilobyte physical, 512 bytes logical sector harddisk on Red Hat Enterprise Linux 5, the partitions must be aligned to 4k boundaries to ensure optimal performance. If the partitions are not properly aligned the drive needs to do a read / modify / write cycle internally for each 4 kilobyte filesystem block written, leading to serious write performance degradation.
The partition tools do not have support for doing the necessary alignment automatically. When adding one of these disks to an existing Red Hat Enterprise Linux 5 system, the partitions need to be manually aligned during the partition process. Additionally, the installer does not have support for doing the necessary alignment automatically. The disks must be manually partitioned before starting the installation and the pre-created partitions used during installation.

3.1.2. Partitioning a 4 kilobyte sector harddisk for optimal performance

To partition these disks for optimal performance, parted must be used and the start and end of the partitions must be given in sectors, not in kilobytes, mega or gigabytes. Specify the start / size in sectors by adding an "s" to the end of the number. Generally, it is a good idea to align the partitions to a multiple of one MB (1024x1024 bytes). To achieve alignment, start sectors of partitions should always be a multiple of 2048, and end sectors should always be a multiple of 2048, minus 1. Note that the first partition can not start at sector 0, use sector 2048 instead.
For example, to create 2 partitions, one of 250 megabytes and one of 500 megabytes, the 250 megabyte partition would then start at sector 2048 and end at sector 514047 (2048 + 250 * 2048 - 1 = 514047). The 500 megabyte partition would start at 514048 (the end of the 250 megabyte partition + 1) and end at 1538047 (514048 + 500 * 2048 - 1 = 1538047).
Using parted this would be achieved as follows:
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel msdos                                                    
(parted) mkpart p ext2 2048s 514047s                                      
(parted) mkpart p ext2 514048s 1538047s
(parted) p                                                                
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  263MB  262MB  primary
 2      263MB   787MB  524MB  primary

(parted) unit s p                                                         
Partition Table: msdos

Number  Start    End       Size      Type     File system  Flags
 1      2048s    514047s   512000s   primary
 2      514048s  1538047s  1024000s  primary