If you run “fdisk -l” and you get something like:
[root@ftp ~]# fdisk -l .... Disk /dev/sdb: 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: 0xec2af3f7 Device Boot Start End Blocks Id System /dev/sdb1 1 121601 976760001 83 Linux Partition 1 does not start on physical sector boundary. |
you’ll notice the message: “Partition 1 does not start on physical sector boundary”
What is the cause and do I need to fix it? If so, how?
Explanation
Your hard disk has Advanced Format 4096-byte sectors to which the partition is not perfectly aligned (Sector size (logical/physical): 512 bytes / 4096 bytes).
This sort of partitioning may affect read/write IO rates and since we all want fast server, my advice is to fix this. To do that, you’ll need to backup all important data from those partition(s) and if you can, use GParted to move the partition so it starts at 4096-byte sector (set the start boundary at 1 MB or so). You can set the start to any logical sector which is a dividable by 8 (64, 256, etc)
If you don’t have GParted as an option (for example no direct access to server and GUI), you can do it with fdisk utility.
In my case, I added the new 1TB drive which is recognized as /dev/sdb. The problem became visible right after I created partition (in my case this is regular storage only disk with one partition)
Create partition
[root@ftp ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x83dabcc9. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) 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. WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): |
As I can see, by default DOS-compatibility mode is On and display units are shown in cylinders
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-121601, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-121601, default 121601): Using default value 121601 |
which leads to
Command (m for help): p Disk /dev/sdb: 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: 0xec2af3f7 Device Boot Start End Blocks Id System /dev/sdb1 1 121601 976760001 83 Linux Partition 1 does not start on physical sector boundary. |
I had a chance to fix this on empty drive so it was easy. In case you have something on your drive, backup first!!!
Delete partition which wasn’t created properly (fdisk /dev/sdb, then “d” option, choose which partition)
As instructed, switch off DOS compatible mode and change the units to sectors by entering the c and u commands:
Command (m for help): u Changing display/entry units to sectors |
Then recreate the partition with
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First sector (2048-1953525167, default 2048): 2048 Last sector, +sectors or +size{K,M,G} (2048-1953525167, default 1953525167): Using default value 1953525167 |
and we have
Command (m for help): p Disk /dev/sdb: 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: 0xec2af3f7 Device Boot Start End Blocks Id System /dev/sdb1 2048 1953525167 976761560 83 Linux |
Great. No annoying message
Write changes with “w”.
Now fdisk -l wont complain.
Since I want new partition to mount as home2, the format command is:
[root@ftp ~]# mkfs.ext4 -L /home2 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label=/home2 OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=1 blocks, Stripe width=0 blocks 61054976 inodes, 244190390 blocks 12209519 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 7453 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 28 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. |
Now that we have created a new file system, we need to mount it. We need to create a mount point which is a directory into which the file system will be mounted.
# mkdir home2 # mount /dev/sdb1 /home2 # mount /dev/sda1 on / type ext4 (rw) ...... /dev/sdb1 on /home2 type ext4 (rw) |
To mount file system automatically at boot time, add an entry to the /etc/fstab.
.... LABEL=/home2 /home2 ext4 defaults 1 2 |
That fixed it. Thank you.
it’great! thanks a lot!
Great!!!! This article helped me a lot
But, i see that fdisk show yet:
Sector size (logical/physical): 512 bytes / 4096 bytes
This is only a display error of fdisk?
Perfect! worked
I have the same issue. But i can not delete the partition.
[root@server ~]# fdisk -l
Disk /dev/sdb: 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: 0xa9407e38
Device Boot Start End Blocks Id System
/dev/sdb1 1 121601 976760001 83 Linux
Partition 1 does not start on physical sector boundary.
——————————————————————————
[root@server ~]# fdisk /dev/sdb
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.
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
sectors (command ‘u’).
Command (m for help): d
Selected partition 1
Command (m for help):
But the partition still there.
What do you have when you type #mount command?