[CentOS] [OT] disk utility showing message "the partition is misaligned by"

Chris Murphy lists at colorremedies.com
Fri Apr 22 22:01:58 UTC 2016


On Fri, Apr 22, 2016 at 4:40 AM, g <geleem at bellsouth.net> wrote:

>
> =+=+=
> $ 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.
> =+=+=

What are these units? Tracks? So 1 = 63, so the start of sdc1 is 1=63?
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.


-- 
Chris Murphy



More information about the CentOS mailing list