当前位置: 代码迷 >> 综合 >> debian SSD ext4 4K 对齐
  详细解决方案

debian SSD ext4 4K 对齐

热度:68   发布时间:2023-12-08 03:03:42.0

新入手了一台thinkpad, 原来的机械硬盘是500G的, 于是购入一块镁光的MX200 250G的SSD来新装debian stable(jessie)


1, 安装系统的之前按住F1进入bios后把模式改为AHCI.
2, 用U盘做的启动盘.版本是debian 8.1 AMD64
3, 安装系统的时候选择默认推荐分区,也就是一整块
4, debian8 默认是ext4 文件系统.
5, 装完后fdisk -lu 发现已经是4K对齐了.

root@debian:/home/tommy# fdisk -luDisk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xa6c609e3Device     Boot  Start       End   Sectors   Size Id Type
/dev/sda1  *      2048    499711    497664   243M 83 Linux
/dev/sda2       501758 488396799 487895042 232.7G  5 Extended
/dev/sda5       501760 488396799 487895040 232.7G 8e Linux LVM
Disk /dev/mapper/debian--vg-root: 223.2 GiB, 239649947648 bytes, 468066304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/mapper/debian--vg-swap_1: 9.5 GiB, 10150215680 bytes, 19824640 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

原来内核>=2.6.3以后ext4就可以直接支持了.

测试下写入

#dd if=/dev/zero of=./largefile bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 0.800335 s, 1.3 GB/s#sh -c "sync && echo 3 > /proc/sys/vm/drop_caches"#dd if=./largefile of=/dev/null bs=4k
262144+0 records in
262144+0 records out
1073741824 bytes (1.1 GB) copied, 4.68755 s, 229 MB/s

这写入速度,1.3GB/s, 读取的速度比较符合接入的是sata2的速度.

参考
https://wiki.debian.org/SSDOptimization?action=show&