Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux disk Partition alignment problem and configuration

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "Linux disk partition alignment problem and configuration", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "Linux disk partition alignment problem and configuration" bar!

What is disk partition alignment (Disk Alignment, Partition Alignment)

Windows disks have a structure called Master Boot Record (MBR), which has a default size of 63 Block (512 bytes each). Its existence results in the dislocation of 63 Block between the initial location of the disk and the initial location of the * partitions on the disk. If the single Track of the disk is greater than 63 Block. This results in the default initial location starting at 64. Make the Track in the file system and above the two Track in the disk. This misalignment can lead to performance degradation of the storage system because a single Track O request spans multiple disks, resulting in additional performance overhead for the storage system. Especially for some applications with larger random Iamp O, the impact will be greater.

For GPT Disk supported after Windows 2003, there will also be misalignment of disk partitions, but the structure is different. As shown in figure 1 (in Block,512 bytes), all partitions are made up of 1MB size (2048 Block), and * partitions start at LBA 34, that is, the 17KB size location. This means that all partitions will have 17KB misalignment. It will also affect the read and write performance of IWeiO.

Alignment of track area of storage system with Linux partition

In order to meet the performance requirements of * *, any Imax O to the back-end storage array needs to be properly structured to avoid the cross-border phenomenon of any Imax O operation. If the Imap O operation crosses multiple boundaries, it will incur additional resource overhead and result in performance degradation. Therefore, in order to avoid the performance impact caused by partition misalignment. You need to use the worker fdisk or parted tool to create and align partitions.

How to choose the correct offset value for disk partitions, basically the value recommended by EMC and other vendors is "64KB". Why did you choose the value of 64KB? explain it here. First of all, let's talk about a concept called physical track region. Because for different types of protection levels, which can also be called Raid and disk types, the scope of this area varies. Let's give two examples:

The track area unit size in the Symmetrix cache is one Track, that is, 64 Block, 32KB sizes. "as shown in figure 2, if the disk partition is not aligned, any 32KB or larger I 8KB O needs to be done across two Track, and 50% of the 16KB 8KB may span two Track,25% or two Track, resulting in additional storage system performance overhead."

After looking at the example of * *, the reader may think that it would be nice to move the starting bit to the right by one Block, (MBR+Reserved=63Block), and there would be no cross-Track. Next, let's look at another example. The single stripe size of a 3x1 Raid5 is four Track, or 256Block, 128KB size. If for this type of disk, the 64th block is used as the starting position, and when the size of the linux Iblock O reaches 64KB, if the Iblock O is directly from the cache (a single track is 32KB), then exactly two reads are completed. However, if there are two consecutive 64KB I 64KB O, and physical disk reads and writes involving the back-end Raid5 are required, as shown in the following figure, the second 64KB will span two stripes, thus doubling the read or write overhead.

In this case, the starting position needs to be adjusted to the recommended configuration (64KB), so that the Linux***I/O size does not occur across multiple stripes. (figure 3)

Therefore, whether the data is read from the cache of the storage system, or in the case where the Imax O does not exist in the cache, the data needs to be read from the underlying physical disk. For different types of disks, the starting point of 64KB is a recommended configuration.

Linux creates partition alignment method

After describing the principle of disk partition alignment, here is an example of how to create an aligned partition using fdisk. In Linux, the alignment partition operation requires empty data, because the alignment partition operation will empty the partition table and the data on the LUN will be deleted. In this example, for the / dev/emcpowerfw device, we create a disk device with a size of 51281 Cylinder (Cylinder is the unit of measurement of Symmetrix, each Cylinder size is 960KB, so the disk size is about 50GB) and the Offset dislocation size is 128block. The method and command output (figure 4) is as follows

Method 1, use fdisk to create partition alignment

Enter at the Linux command prompt:

# fdisk / dev/emcpowerfw

Enter n to create a partition:

Enter p to create the primary partition:

Enter the starting Cylinder location. The default is *:

Enter the * Cylinder location, which defaults to * a Cylinder of the disk device:

Enter x to enter expect mode:

Enter b, the initial location of a certain partition:

Set the initial position to 128block (128block size to 64KB):

Enter p again to confirm the initial location information of the partition:

Enter w to save exit:

Method 2: create aligned partitions using parted

Parted supports more types (GPT) and larger partition sizes than fdisk. The following example shows an example of creating 128bloc partition start bits for a dev/sdb disk. The method and command output are as follows (figure 5)

Enter at the Linux command prompt:

# parted / dev/sdb

Adjust the display units to Sector (size 512 bytes):

(parted) unit s

List the current logical volumes:

(parted) print

Remove the original Number1 and create a primary partition with a starting bit of 128 sector and a small size of 976735934 sector.

(parted) rm 1

(parted) mkpart primary 128 976735934

(parted) print

Thank you for reading, the above is the content of "Linux disk partition alignment and configuration". After the study of this article, I believe you have a deeper understanding of the problem of Linux disk partition alignment and configuration, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report