天天看點

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對齊了。