Linux分区的4k对齐,linux查看硬盘4K对齐方法

2023-05-16

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

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

[root@localhost ~]# 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对齐了。

[root@localhost ~]# 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来查看。

[root@localhost ~]# 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对齐了。

[root@localhost ~]# 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对齐了。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Linux分区的4k对齐,linux查看硬盘4K对齐方法 的相关文章

随机推荐