Partition does not start on physical sector boundary? (From ASK Ubuntu)

本文解答了关于硬盘分区未正确对齐到物理扇区边界的问题,详细解释了现代硬盘使用4096字节扇区的原因及如何通过Gparted等工具调整分区以改善读写性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The Question:

 

I've one HD on my laptop, with two partitions (one ext3 with Ubuntu 12.04 installed and one swap).

fdisk is giving me a Partition 1 does not start on physical sector boundary warning. What is the cause and do I need to fix it? If so, how?


 

This is sudo fdisk -l:

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 testine, 63 settori/tracce, 91201 cilindri, totale 1465149168 settori
Unità = settori di 1 * 512 = 512 byte
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Identificativo disco: 0x5a25087f

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63  1448577023   724288480+  83  Linux
Partition 1 does not start on physical sector boundary.
/dev/sda2      1448577024  1465147391     8285184   82  Linux swap / Solaris

This is sudo lshw related result:

 *-disk
                description: ATA Disk
                product: WDC WD7500BPKT-0
                vendor: Western Digital
                physical id: 0
                bus info: scsi@0:0.0.0
                logical name: /dev/sda
                version: 01.0
                serial: WD-WX21CC1T0847
                size: 698GiB (750GB)
                capabilities: partitioned partitioned:dos
                configuration: ansiversion=5 signature=5a25087f
              *-volume:0
                   description: EXT3 volume
                   vendor: Linux
                   physical id: 1
                   bus info: scsi@0:0.0.0,1
                   logical name: /dev/sda1
                   logical name: /
                   version: 1.0
                   serial: cc5c562a-bc59-4a37-b589-805b27b2cbd7
                   size: 690GiB
                   capacity: 690GiB
                   capabilities: primary bootable journaled extended_attributes large_files recover ext3 ext2 initialized
                   configuration: created=2010-02-27 09:18:28 filesystem=ext3 modified=2012-06-23 18:33:59 mount.fstype=ext3 mount.options=rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered mounted=2012-06-28 00:20:47 state=mounted
              *-volume:1
                   description: Linux swap volume
                   physical id: 2
                   bus info: scsi@0:0.0.0,2
                   logical name: /dev/sda2
                   version: 1
                   serial: 16a7fee0-be9e-4e34-9dc3-28f4eeb61bf6
                   size: 8091MiB
                   capacity: 8091MiB
                   capabilities: primary nofs swap initialized
                   configuration: filesystem=swap pagesize=4096

 

These are related /etc/fstab lines:

UUID=cc5c562a-bc59-4a37-b589-805b27b2cbd7 /               ext3    errors=remount-ro,user_xattr 0       1
UUID=16a7fee0-be9e-4e34-9dc3-28f4eeb61bf6 none            swap    sw   

 

Answers:

 

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.

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 it's 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 either:

  1. Resize the erroneously sized partition to the proper size.
  2. 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 this screenshot.

The source site: http://askubuntu.com/questions/156994/partition-does-not-start-on-physical-sector-boundary

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值