Block devices are important to host performance. Correct configuration of the block device queue depth, scheduling algorithm, prefetch amount, and I/O alignment improves system performance.
I/O Alignment
If MBR partitions are created in Linux or Windows (pre Windows Server 2003 versions), the first 63 sectors of a disk are reserved for the master boot record and partition table. The first partition starts from the 64th sector by default. As a result, misalignment occurs between data blocks (database or file system) delivered by hosts and data blocks stored in the storage array, causing poor I/O processing efficiency.
In Linux, you can resolve I/O misalignment in either of the following ways:
l Method 1: Change the start location of a partition.
When creating MBR partitions in Linux, it is recommended that you enter the expert mode of the fdisk command and set the start location of the first partition to that of the second extent on a LUN. The default extent size is 4 MB. The following is a quick command used to create an MBR partition in /dev/sdb. The partition uses all space of /dev/sdb. The start sector is set to 8192, namely, 4 MB.
printf "n\np\n1\n\n\nx\nb\n1\n 8192\nw\n" | fdisk /dev/sdb
l Method 2: Create GPT partitions.
The following is a quick command used to create a GPT partition in /dev/sdb. The partition uses all space of /dev/sdb. The start sector is set to 8192, namely, 4 MB.
parted -s -- /dev/sdb "mklabel gpt" "unit s" "mkpart primary 8192 -1" "print"
To create MBR partitions in Windows (pre Windows Server 2003 versions), it is recommended that you run diskpart to set partition alignment.
diskpart> select disk 1
diskpart> create partition primary