Disk Utility Showing Message “the Partition Is Misaligned By”

Home » CentOS » Disk Utility Showing Message “the Partition Is Misaligned By”
CentOS 9 Comments

greetings.

CentOS 6.7 [current]

‘disk utility’ has started showing message;

WARNING: The partition is misaligned by 2560 bytes. This may
result in very poor performance. Repartitioning is suggested.

for sdc5 – /home partition.

/dev/sdc5 302243312 156348604 130534968 55% /home
/dev/sdc7 80854912 57088 76683952 1% /hdd/c/07

other than time involved to backup sdc5, repartition is not a problem.

to my thinking, but not recalling, with fsck;

fsck -rN -t ext4 /dev/sdc5 * to check repairs
fsck -r -t ext4 /dev/sdc5 * to repair

gparted was used to partition drive. is pmagic live a better choice, or should i return fdisk because;

=+=+$ sudo fdisk -l /dev/sdc
[sudo] password for geo:

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x0009ede7

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 103 819200 83 Linux Partition 1 does not end on cylinder boundary.
/dev/sdc2 103 230 1024000 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary.
/dev/sdc3 230 2107 15073280 83 Linux
/dev/sdc4 2107 121602 959844352 5 Extended
/dev/sdc5 2108 42019 320587970+ 83 Linux Partition 5 does not start on physical sector boundary.
=+=+
suggestions for correcting above boundaries also appreciated.

help needed and greatly appreciated.

9 thoughts on - Disk Utility Showing Message “the Partition Is Misaligned By”

  • Am 22.04.2016 um 12:40 schrieb g :

    check it with:

    blockdev –getalignoff /dev/sd

    (if a ‘0’ is returned, the partition is aligned)

  • Leon Fauster wrote:


    1. fsck won’t do anything at the lower level of partitioning.
    2. A few years ago I personally tested this, and yes, an aligned partition
    *does* make a significant difference in access time.
    3. I’ve only used gparted once or twice. In user-surly parted, you want to run it as
    $ parted -a opt /dev/sdc
    then, when mkpart, be sure to use start and end as something like x.0GB, +x.0GB,
    and parted will do the alignment correctly. (As opposed to only telling you
    that the alignment is not optimal, rather than *telling* you what you should be
    doing to make it optimal.)

    mark

  • <<>>

    ===>

    Leon, thank you for reply.

    ]$ sudo blockdev –getalignoff /dev/sdc1
    0
    ]$ sudo blockdev –getalignoff /dev/sdc2
    0
    ]$ sudo blockdev –getalignoff /dev/sdc5
    2560
    ]$ sudo blockdev –report /dev/sdc1
    RO RA SSZ BSZ StartSec Size Device rw 256 512 4096 2048 838860800 /dev/sdc1
    ]$ sudo blockdev –report /dev/sdc2
    RO RA SSZ BSZ StartSec Size Device rw 256 512 4096 1640448 1048576000 /dev/sdc2
    ]$ sudo blockdev –report /dev/sdc5
    RO RA SSZ BSZ StartSec Size Device rw 256 512 4096 33848955 328282081792 /dev/sdc5

    so, blockdev does not show end, but does confirm sdc5 start is off by 2560, same as fdisk.

    all of which indicates i should repartition drive with fdisk.

    is there any easier way such as using gparted or sparted so that partitioning will be by cylinder and not sector?

    thank you again. much appreciate.

  • You do not want to partition by cylinder. The CHS geometry that fdisk reports has been meaningless on hard disks for at least the last 10 years and bears no relationship to the actual cylinders on the drive. At that arbitrary 255 heads 63 sectors/track geometry, you might have to skip over 7 full “cylinders” to find one that starts on a 4096-byte boundary. The version of fdisk in CentOS 6
    is old, and still defaults to the deprecated cylinder units. You should always switch to sector units when using it. The warning about partitions that do not start or end on a cylinder boundary should be ignored.

  • What are these units? Tracks? So 1 = 63, so the start of sdc1 is 1c?
    Annoying. I wish these tools would get updated to do sectors by default, tracks are useless.

    You can try

    parted /dev/sdc u s p

    That should be in sectors. If the start value is divisible by 8, it is
    4KiB sector aligned, *assuming* the drive does not have a jumper enabled for Windows XP compatibility. I’d like to believe those drives are long gone by now but heck we keep running into ancient versions of fdisk and parted with bad legacy behaviors.

    Use gparted booted from say a Fedora 23 live workstation USB stick
    (created with dd), and ‘dnf install gparted’. There’s an option to move/resize. Just give it a new start value and keep the size the same. Moving takes a long time, every sector for the chosen partition has to be copied and moved forward or backward.

    Or back it up, blow it away, and repartition. Any new tool should warn or flat out prevent you from improperly aligning but the simplest way to do it is to always align on 1MiB boundaries. For example partition
    1 starts at LBA 2048 which is 1MiB aligned, and now make all partitions sized in MiB increments and they will all align

    Depending on the age of the file system, it’s not a bad idea to just start over every once in a while.

  • <>

    ===>

    thank you all for replies. most helpful. now to decide which way to format a new drive that i now have on order.

    after reading replies, i feel easiest way to get a good partition layout was a complete repartitioning and formatting.

    easiest way to do that is start with a new drive. during install, i will do partitioning and formatting. that is i am presuming that installation will know how to properly set up partitions so that all partitions are by full cylinders.

    after new install, transfer my current /home to new drive, wipe current drive, partition and format it.

    anyone see anything wrong with such thinking?

  • g wrote:

    I assume you would have to run grub2-mkconfig and grub2 install or equivalent.

  • A new install will default to partitions with 1-Megabyte alignment
    (2048 LBA sectors). That is totally unrelated to “cylinders”.

  • ===>

    Robert, apologies for delay in replying.

    in checking back thru old threads before archiving, i found that i failed to thank you for reply.

    my apologies and thank you.