по-русски

Home Background Download FAQ Support Donate

Information on this page will help to understand how AF-disks work and why the volumes should be aligned.

It is known the disk presents the persistent memory of computer. We can write some information to the disk and read it later. The reading and writing are main operations the disk must perform. All data on the disk are divided into regular pieces. These pieces are called sectors. Most of disks have the standard size sector of 512 bytes. The sector is a minimal amount information that can be processed by disk. This means we cannot ask the disk to read 7 or 13 bytes. It is unable to do so. But the request for read 1 sector or even 1000 sectors at once the disk will execute with pleasure. Every sector has its sequential number (linear address). The disk needs the sector address for each read or write request.

There are disks that have sector with size more than 512 bytes, for example 4096 bytes. The greater sector allows to use the disk surface more effectively. This is because the disk keeps the service information along with user data. Increasing sector reduces the percentage of service data and therefore raises the disk capacity. Suddenly it is not easy to just enlarge the sector size. The heaps of software can work only with standard 512-bytes sector. In rush of the capacity raising the disk manufacturers have come to the next solution. The service data are kept for greater sector but read and write requests contain the addresses for standard sector size as before. Actually there are two sectors: internal (physical) and external (logical). The disk has the greater sector size internally and emulates the standard sector size for all external requests. In other words the disk translates the logical sector addresses to the physical addresses. For outside user such disk is indistinguishable from ordinary disk so all software works fine. This technology is called Advanced Format. The disks built with it we will name as AF-disks. As a rule the physical sector has 4096 bytes length and logical sector is exactly 8 times less, the standard 512 bytes.

Now it is useful to take a look at the read and write operations that are being executed by AF-disk. For example, the read request of sector #9 leads to next actions within the disk:

  1. Logical address 9 is being translated to physical address 1 (whole part of 9•512/4096).
  2. It is reading 4096 bytes of physical sector #1 into the internal disk buffer.
  3. The disk is retrieving the data from buffer that correspond the logical sector #9. It is bytes at indexes from 512 to 1023 inclusive. Other bytes are ignored.
The writing of same sector #9 goes so:
  1. Logical address 9 is being translated to physical address 1 again.
  2. It is reading 4096 bytes of physical sector #1 into the internal disk buffer.
  3. Bytes from 512 to 1023 are being replaced with new data.
  4. It is writing the physical sector #1 with the internal buffer data.
As we see the AF-disk's operations are more complicated as compared with the ordinary disk. Moreover the write operation makes the reading now! This can undermine the disk performance.

The poor situation is rescued by the file system. The file system operates with data blocks, so named clusters. Widespread cluster size is the same 4096 bytes. Lets the cluster occupies the logical sectors from 8 to 15. The writing of such cluster AF-disk performs in this way:

  1. Logical addresses 8 and 15 are being translated to the physical address 1.
  2. It is writing the physical sector #1.
The read operation has been disappeared! The key condition for this optimization is the writing of the continuous block of logical sectors that covers exactly the one physical sector. In other words the write operation is aligned in relation to the physical sector.

The story doesn't end here because there is a volume between disk and file system:

Most users see volumes as letters C:, D: and so on. The volumes make possible to have several file systems on one disk. Every volume has one or more continuous areas of the logical sectors on the disk. Such area is called extent. The location of volume's extents defines the alignment relatively the physical sector.

Let's look on the simple volume. Its only extent is located on the disk starting the sector #16:

As we see from picture, every cluster of the file system is mapped exactly on the physical sector. This volume is aligned properly and AF-disk will achieve the best performance in this case.

Suddenly the popular operating system Windows XP locates the volumes starting the sector #63 on the disk. The number 63 cannot be divided by 8 without remainder. So partitioning with standard Windows XP tools makes the volume unaligned:

In this case AF-disk will perform the additional reads in write operations and slow down.

Complicating matters, the manufacturers have equipped some disk models with jumper that adds one to the logical address before translation into physical address. First 512 bytes of disk are not mapped to any logical sector, these bytes are not in use. See the picture:

If jumper is set the volume created by Windows XP becomes right aligned.

Let's sum up:

  • AF-disks use the magnetic surface more effectively but require the alignment of read/write operations in relation to the physical sector for best performance.
  • The operations are right aligned on two conditions:
    1. The file system cluster is multiple of physical sector size.
    2. The start of every volume's extent is on the physical sector boundary.

Have questions ? – email to


Copyright © 2011, Sergey Volynkin