天天看点

linux fdisk 4k,linux查看硬盘4K对齐方法

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

大容量硬盘可能存在4k分区对齐的问题,对于传统MBR分区,可以使用 fdisk -lu 命令查看

[[email protected] ~]# fdisk -lu /dev/sda

Disk /dev/sda: 2000.3 GB, 2000398934016 bytes

255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors

Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 63 102398309 51199123+ fd ext3

/dev/sda2 102398310 106494884 2048287+ fd ext3

/dev/sda3 106494885 2136644999 1015075057+ fd ext3

/dev/sda4 2136645000 3907024064 885189532+ fd ext3

start开始的扇区能不被8整除,就表示没有4k对齐了。

[[email protected] ~]# fdisk -lu /dev/sda

Disk /dev/sda: 2000.3 GB, 2000398934016 bytes

255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors

Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 2048 102398309 51199123+ fd ext3

/dev/sda2 102398310 106494884 2048287+ fd ext3

/dev/sda3 106494885 2136644999 1015075057+ fd ext3

/dev/sda4 2136645000 3907024064 885189532+ fd ext3

start开始的扇区能被8整除,就表示4k对齐了。

早期的Linux下分区命令fdisk或者parted 由于版本较低,不支持4k分区对齐,请使用较新的Linux发行版,比如Linpus Lite 2.1等,

都不存在这个问题。

对于GPT分区,可以使用parted /dev/sda unit s print来查看。

[[email protected] ~]# parted /dev/sda unit s print

Model: ATA WDC WD20EARX-00P (scsi)

Disk /dev/sda: 3907029167s

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 63s 102398309s 102398247s primary ext3 boot

2 102398310s 106494884s 4096575s primary linux-swap

3 106494885s 2136644999s 2030150115s primary ext3

4 2136645000s 3907024064s 1770379065s primary ext3

start开始的扇区能不被8整除,就表示没有4k对齐了。

[[email protected] ~]# parted /dev/sda unit s print

Model: ATA WDC WD20EARX-00P (scsi)

Disk /dev/sda: 3907029167s

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 2048s 102398309s 102398247s primary ext3 boot

2 102398310s 106494884s 4096575s primary linux-swap

3 106494885s 2136644999s 2030150115s primary ext3

4 2136645000s 3907024064s 1770379065s primary ext3

start开始的扇区能被8整除,就表示4k对齐了。