今天给一块硬盘分区,用fdisk按照默认步骤执行,遇到这个问题:
[root@bogon ~]# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x59c8eb29.
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)
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): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-121597, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-121597, default 121597):
Using default value 121597
Command (m for help): p
Disk /dev/sdf: 1000.2 GB, 1000171331584 bytes
255 heads, 63 sectors/track, 121597 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk identifier: 0x59c8eb29
Device Boot Start End Blocks Id System
/dev/sdf1 1 121597 976727871 83 Linux
Partition 1 does not start on physical sector boundary.
在网上搜了一圈,说是逻辑扇区与物理扇区的大小不一样的原因。可是我这机器的逻辑扇区与物理扇区的大小是一样的啊
Sector size (logical/physical): 512 bytes / 512 bytes
好在还是找到了解决办法。办法有两种,一是按u切换到以扇区为单位,二是按c关闭dos兼容模式。前者最简单,如下:
[root@bogon ~]# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xc466de3d.
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)
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): u
Changing display/entry units to sectors
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (63-1953459631,
default 512):
Using default value 512
Last sector, +sectors or +size{K,M,G} (512-1953459631, default 1953459631):
Using default value 1953459631
Command (m for help): p
Disk /dev/sdf: 1000.2 GB, 1000171331584 bytes
255 heads, 63 sectors/track, 121597 cylinders, total 1953459632 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk identifier: 0xc466de3d
Device Boot Start End Blocks Id System
/dev/sdf1 512 1953459631 976729560 83 Linux
Command (m for help):
注意到fdisk给出的默认起始扇区是512,按这个值生成的分区是对齐的。我们可以算出物理扇区大小应该是512*512=262144,为毛显示成512呢?
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
仔细一看,I/O size显示的正好是262144。这么说物理扇区大小显示错了?不解。这个系统是64位Redhat6.4。