How to fix "Partition does not start on physical sector boundary" warning?

Solution 1:

Your hard disk has Advanced Format 4096-byte sectors to which the partition is not perfectly aligned

This line explains the warning:

Sector size (logical/physical): 512 bytes / 4096 bytes
  • Your hard disk is one of the newer models which uses the Advanced Format of 4096 bytes per physical sector instead of the older 512 bytes/sector.
  • These HDDs can still provide a "legacy" emulation of 512 bytes/sector, which is why you see the logical sector size as 512.
  • In fact, lshw shows it's a Western Digital drive, the first company to switch to AF. They have an extensive page with lots of information on it, which you may wish to look at.

Thus, the warning occurs because partition 1 starts at logical sector 63 = byte 32256, a number not divisible by 4096; in fact it's near the end of the 7th physical sector (position 7.875 to be exact :)

Should you fix it? If so, how? [always backup!]

In theory this sort of partitioning may affect read/write IO rates somewhat, depending on your drive's firmware. If you are happy with the performance now, ignore the warning, and no need to do anything. If not, backup all important data first, and then use Gparted to move the partition so that it starts at 4096-byte sector; setting the start boundary at 1 MiB is an easy way to do it.

  • Technically, you can set the start to any logical sector which is a multiple of 8, e.g. 64 is good, 256 is good, etc., but 63, 255... are not.

Solution 2:

For your new HDD, first create partitions using gparted as per your wish.

Then, access your HDD using sudo fdisk device_name. m command in fdisk will print help menu.

npcompete@npcompete-desktop:~$ sudo fdisk /dev/sda

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0008e009

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   209717247   104857600   83  Linux
/dev/sda2       209717248  1953525167   871903960    5  Extended
/dev/sda5       600349113   795667319    97659103+  83  Linux
Partition 5 does not start on physical sector boundary.
/dev/sda6       795667383   990985589    97659103+  83  Linux
Partition 6 does not start on physical sector boundary.
/dev/sda7       990985653  1953520064   481267206   83  Linux
Partition 7 does not start on physical sector boundary.
/dev/sda8       209719296   600349112   195314908+  83  Linux

Partition table entries are not in disk order
Command (m for help): d
Partition number (1-8): 5

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0008e009

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   209717247   104857600   83  Linux
/dev/sda2       209717248  1953525167   871903960    5  Extended
/dev/sda5       795667383   990985589    97659103+  83  Linux
Partition 5 does not start on physical sector boundary.
/dev/sda6       990985653  1953520064   481267206   83  Linux
Partition 6 does not start on physical sector boundary.
/dev/sda7       209719296   600349112   195314908+  83  Linux

Partition table entries are not in disk order

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
npcompete@npcompete-desktop:~$ sudo fdisk /dev/sda

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

Command (m for help): n
Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l
Adding logical partition 8
First sector (600351161-1953525167, default 600352768): 
Using default value 600352768
Last sector, +sectors or +size{K,M,G} (600352768-795667382, default 795667382): 
Using default value 795667382

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0008e009

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   209717247   104857600   83  Linux
/dev/sda2       209717248  1953525167   871903960    5  Extended
/dev/sda5       795667383   990985589    97659103+  83  Linux
Partition 5 does not start on physical sector boundary.
/dev/sda6       990985653  1953520064   481267206   83  Linux
Partition 6 does not start on physical sector boundary.
/dev/sda7       209719296   600349112   195314908+  83  Linux
/dev/sda8       600352768   795667382    97657307+  83  Linux

Partition table entries are not in disk order

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Now delete the partition which gives warning using d option in fdisk.

First Command d, then the partition number (mentioned in the warning).

Now write the changes to the disk using w command. It will exit from the fdisk.

Second time access your HDD using sudo fdisk device_name.

Now create a new partition using the free space(previously we have deleted a partition, that will be the free space or unallocated space) using n command in fdisk.

In New partition command don't enter any value for First and Last Sector, just press Enter. it will take the default value.

Now write the changes to the disk using w command. It will exit from the fdisk.

Do the above steps for all the partitions. After finishing this format your newly created partitions, using gparted. (That's what I did worked for me. No warnings in fdisk -l output.)

Solution 3:

As pointed out by izx:

your hard disk has Advanced Format 4096-byte sectors to which the partition is not perfectly aligned.

The advanced format specification and its impact on user-side hard drive partitioning practices is explained nicely by this article.

To fix this issue you must backup your data and then:

  1. Either resize the erroneously sized partition to the proper size;
  2. Or delete the erroneously sized partition and create a new partition of the proper size.

To accomplish this using the graphical hard-drive partitioning software that is called GParted then you can:

  1. Launch the Gparted application with super-user privileges; exercise caution!

    gksudo gparted
    
  2. Select the storage device containing the erroneously sized partition from the pull-down menu in the upper right hand corner of the GParted menu.

  3. Select the erroneously-sized partition by clicking on it in the rectangular partition map.

  4. Now you may choose to delete and create a new partition or you may choose to resize the existing partition. Regardless of your choice you will reach a menu that allows you to set the size of the partition. You must clear the "Round to cylinders" checkbox and set the size of the free space preceding to 1MiB. It will look similar to

GParted - Create new partition.

Solution 4:

By switching the "u" units. The default sector size will show up when you create the partition. If you are starting to partition a new disk and you get this error, you can.

  1. create a partion with the defaut.
  2. n,p,1,Enter, Enter
  3. Display and get the partition error message. "p".
  4. switch units "u"
  5. delete the partition. "d"
  6. Now create again. this time the defaults will show the correct sector. (in my case it was 1024).

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-72937, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-72937, default 72937):
Using default value 72937

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       72937   585866421   83  Linux
Partition 1 does not start on physical sector boundary.

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders, total 1171743836 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63  1171732904   585866421   83  Linux
Partition 1 does not start on physical sector boundary.

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders, total 1171743836 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 8
Value out of range.
Partition number (1-4): 1
First sector (63-1171743835, default 1024):
Using default value 1024
Last sector, +sectors or +size{K,M,G} (1024-1171743835, default 1171743835):
Using default value 1171743835

Command (m for help): p

Disk /dev/sdb: 599.9 GB, 599932844032 bytes
255 heads, 63 sectors/track, 72937 cylinders, total 1171743836 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 524288 bytes
Disk identifier: 0x2016bdc5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            1024  1171743835   585871406   83  Linux

Command (m for help): w
The partition table has been altered!