Partition alignment on modern hard drives using software tools

    The advent of modern hard drives with sectors of 4 KB in size (instead of 512 bytes) made the problem of partition alignment relevant for both IT professionals and ordinary users. The thing is that the mismatch between the physical and logical distribution of data can lead to a sharp decrease in the performance of the entire system and shorten the life of the equipment.

    To explain the essence of partition alignment, we illustrate the placement of data stored on a regular hard drive:

    image

    The figure shows a simplified segmentation scheme, where one partition takes up all the disk space and all sectors. The section corresponds to the first sector, the beginning of the section corresponds to the beginning of the first sector. However, this is too simplified. After all, a section consists of logical units / blocks. Consider how they are related to sectors:

    image

    The figure shows that two sectors correspond to one cluster. This means that when reading data, for example, a small text file from one cluster, the storage device reads data from two sectors.
    Please note: the beginning of the section corresponds to the beginning of the first sector and all clusters are aligned by sectors, therefore, the section is aligned. Data operations are performed at maximum speed.
    Now we consider the reasons for the inconsistency of the sections of the sectors and the consequences of this phenomenon.

    How and why the mismatch of partitions and sectors slows down the hard drive?

    The physical sectors of modern hard drives (for example, Western Digital) are 4096 bytes in size, and 4 KB blocks of data are processed at the physical level, but for external hardware and software such disks look like “traditional” with 512 byte sectors. This ensures compatibility with earlier software versions. In such cases, one more level is added - the compatibility level.

    image

    The figure shows three levels of data distribution. The lower level is, in fact, the hard drive and physical sectors of 4 KB. The second level is an abstract representation in the form of sectors of 512 bytes in size for external systems. And the highest level is the current file system with 2 KB clusters, each of which is equal to four abstract sectors and half of the physical sector. Thus, 1 cluster = 4 abstract sectors = ½ of the physical sector.

    Note that all three levels are aligned relative to each other and the beginning of the disk. Thus, reading or writing data from one cluster is implemented using four sectors of 512 bytes and one sector of size 4KB. The number of read / write operations is minimal; the drive works at maximum performance.

    But the situation changes for the worse when logical-level clusters are shifted relative to the layers below, as shown in this figure:

    image

    As you can see, the partition is shifted relative to the beginning of the disk by one sector of 512 bytes in size. As a result, several logical clusters were found to be associated with two physical sectors of 4KB (second, fourth and sixth), which led to a doubling of the number of read / write operations. In this case, the system performance decreases, because for data management the hard drive performs two operations in two sectors instead of one, as if the partitions were correctly aligned.

    What are the causes of the bias? When creating clusters of volumes, all versions of Windows prior to Vista are oriented to 512-byte sectors and place the beginning of the partition according to them, rather than 4 KB sectors as shown in the previous figure, where the beginning of the partition is shifted by one 512-byte sector.

    Typically, a section begins with 63 sectors. 63 sectors - the established size of the “cylinder” of the disk and some older versions of DOS or Windows require that the partition be aligned with the “cylinder” for the correct addressing and access to the sectors. Modern operating systems do not use the outdated CHS addressing scheme (cylinder / read head / sector). But for a number of reasons, all versions of Windows prior to Vista create partitions by this rule.

    Interestingly, sections aligned across 63 sectors, for purely mathematical reasons, are not aligned across 4 KB sectors.

    image

    Obviously, 63 sectors of 512 bytes do not correspond to an integer number of 4 KB sectors. Thus, the first and all subsequent disk partitions will be located with an offset.

    image

    What does the Paragon Alignment Tool do?

    In the coming days, Paragon Software will introduce the Paragon Alignment Tool (PAT). In fact, it moves partitions to a number of sectors of 512 bytes, aligning volumes. For example, to align a partition with a size of 63 sectors, you just need to move it forward by one sector of 512 bytes in size.

    image

    Now the beginning of the section corresponds to the beginning of the 4KB sector, and this section, and all subsequent ones, are located correctly.

    image

    PAT shifts the beginning of the partition by 2048 sectors 512 bytes from the beginning of the disk, which corresponds to 1 MB, and is also great for 4 KB sectors.

    The need for partition alignment for SSDs

    For SSDs, the problem of incorrect partitioning is even more relevant than for traditional hard drives. The size of the memory modules of modern SSDs is 4096 bytes, which is an analogue of the 4 KB sectors. Thus, all the problems mentioned above related to partition alignment also arise when using SSDs.

    However, in addition to reducing the speed of the file system, there is another problem that is unique to SSDs. Solid-state drive memory cells fail faster with a large number of write operations. Thus, if the partitions on the SSD are incorrectly located, not only the speed of the system decreases, but the solid state drive itself is also endangered.

    Aligning partitions with PAT eliminates redundant read / write operations, which can significantly increase the speed and extend the life of the SSD.

    The need for partition alignment for SAN and RAID

    RAID technology allows you to combine many hard drives and other storage devices into one large data array. The system perceives this array as one large storage device, and data is distributed across all its resources. The amount at which data ceases to be written to one disk of the array and begins to be written to another is called the size of the stripe, which, in turn, can be very different (8 KB, 16 KB, 32 KB or 64 KB).

    When using software or hardware RAID, system performance may decrease if the initial position of the partition does not match the size of the stripe. In this case, the number of data operations on several disks of the RAID array increases.

    To solve this problem, PAT shifts partitions to 2048 sectors. This offset is suitable for most stripe sizes. Working with data becomes faster by eliminating redundant operations.

    The need for partition alignment in virtual environments

    Partition alignment in a virtual infrastructure environment is critical to performance, equipment life, and efficient storage utilization. Incorrect partitioning results in the virtual machine receiving more data from the array than requested. This not only reduces work efficiency, with such an excessive load, more resources are required for data storage.

    image

    This figure shows the configuration of the VMware ESX \ Server \ vSphere server using RAID / SAN storage. Here the sections are incorrectly located at once on two levels, which leads to a serious decrease in performance. For example, in order to read data from the first cluster, the system must read three VMFS blocks and four RAID blocks (and even more stripes).

    Currently PAT cannot move VMFS volumes themselves, but it can align partitions on virtual disks.

    image

    With this configuration, all volumes and partitions are located correctly and the overall speed of data operations has doubled.

    Also popular now: