GPT and WD Advanced format

    One of the sudden problems when using GPT- (if we want to see a decent recording speed) the need to manually adjust the position of the partition on WD disks with Advanced format. The essence of Advanced Format is simple: inside the disk has 4k sectors, outside they are emulated as 512-bytes. If we record two sectors within the same 4k block, it is recorded once. If we record two sectors so that we touch two 4k sectors, the disk has to read two sectors, update information and write them back. Bad and slow. Modern operating systems use 4k blocks for writing, so if we get it right, then each write operation will be just a write, without reading. If we get uneven (for example, 2kb from the first sector and 2kb from the second), then we will get huge brakes (see the link below to the IBM website with statistics on “braking” when markup errors).

    WD, when thinking about 512 VS 4k, did not take into account that in addition to MBR there is also GPT. In the case of 2TB disks, MBR still suffers, however, there are 3TB disks ahead, and in them MBR simply cannot mathematically provide partitions and the transition to GPT is inevitable.

    So the problem of GPT and WD needs to be considered today. The main tool for manipulating the GPT at the moment is parted and its graphical version of gparted. Unfortunately, gparted does not know what we need, so everything that follows describes how to use parted.

    The main idea: All values ​​(beginning, end of section) should be a multiple of 4kB, or, a little easier, 8 sectors. This is a requirement of WD advanced format.

    The GPT itself takes up some volume (33 sectors: 32 GPT sectors, 1 sector is a fake MBR plug), so the first multiple is the 8th number with which we can work - 40 sectors. The final number depends on the disk capacity, but also, preferably, a multiple of 8. In addition, the GPT is duplicated at the end of the disk, so the space at the end of the disk will also be “bitten”.

    For best performance, consider the PE size for LVM - 4Mb (8192 sectors) and set the volume size to a multiple of the number of PEs. As a result of all these manipulations, we will lose a little bit of space (less than 8 MB), but we will get a fast volume that will have no “unused" kilobytes in the description in LVM.

    In addition, there is also the opinion of gparted himself that the best position of a volume is in multiples of megabytes. Thus, the final requirements are as follows: the volume must begin and end at values ​​that are multiples of 4MB.

    So, creating an LVM volume on a WD’s disk with Advanced Format: creating a

    # parted /dev/sdx

    mklabel gpt
    GPT partition table

    unit s
    # take a place in sectors.

    > Disk / dev / sdx: 3907029168s
    display information about the screw.

    In this conclusion, we are interested in the number of sectors, pay attention, since we have a WD'sh disk, then the number of sectors must be a multiple of 8. If it is not a multiple of 8, it is either not Advanced Format, or someone is playing with jumpers, or something else terrible happened (for example, you made a mistake with the screw and just the mklabel gpt command demolished the contents of the disk with the most valuable).

    We consider our values: the oldest, a multiple of 8192 sectors, is 3907026944. By the way, here is a little trickery, we lose the place not twice, but one, because the total size of our volume will be 3907029168-8192 sectors.

    mkpart primary 8192 3907026944

    > Warning: You requested a partition from 39s to 3907029167s appears.
    > The closest location we can manage is 39s to 3907029134s.
    > Is this still acceptable to you?
    > Yes / No?

    That means that you made a mistake with the math and you need to recount again.

    After creating the partition, you can exit parted and perform the usual LVM rituals: pvcreate, vgexpand, etc.

    References :

    Also popular now: