我有一个外部硬盘 (不是固态硬盘),它报告:
Sector Sizes: 512 bytes logical, 4096 bytes physical
我应该使用 --sector-size 512
还是 --sector-size 4096
使用cryptosetup LuksFormat
?使用默认参数(不确定它是否会尝试自动检测或始终使用 512)最终得到 512。
如果重要的话,设置将是[disk]->[gpt]->[physical partition]->[LUKSv2]->[btrfs]
继续使用这两种方式来收集基准:
512
# sysbench fileio prepare
2147483648 bytes written in 34.28 seconds (59.75 MiB/sec).
# sysbench fileio --file-test-mode=rndrw run
Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...
Threads started!
File operations:
reads/s: 14.42
writes/s: 9.62
fsyncs/s: 31.25
Throughput:
read, MiB/s: 0.23
written, MiB/s: 0.15
General statistics:
total time: 12.4778s
total number of events: 562
Latency (ms):
min: 0.00
avg: 17.84
max: 365.73
95th percentile: 84.47
sum: 10024.98
Threads fairness:
events (avg/stddev): 562.0000/0.00
execution time (avg/stddev): 10.0250/0.00
# sysbench fileio --file-test-mode=seqrewr run
Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential rewrite test
Initializing worker threads...
Threads started!
File operations:
reads/s: 0.00
writes/s: 815.93
fsyncs/s: 1045.19
Throughput:
read, MiB/s: 0.00
written, MiB/s: 12.75
General statistics:
total time: 10.0488s
total number of events: 18576
Latency (ms):
min: 0.00
avg: 0.54
max: 433.66
95th percentile: 0.02
sum: 9996.57
Threads fairness:
events (avg/stddev): 18576.0000/0.00
execution time (avg/stddev): 9.9966/0.00
4096年
# sysbench fileio prepare
2147483648 bytes written in 28.85 seconds (70.99 MiB/sec).
# sysbench --test=fileio --file-test-mode=rndrw run
File operations:
reads/s: 26.17
writes/s: 17.45
fsyncs/s: 58.35
Throughput:
read, MiB/s: 0.41
written, MiB/s: 0.27
General statistics:
total time: 11.4636s
total number of events: 1041
Latency (ms):
min: 0.00
avg: 9.63
max: 370.49
95th percentile: 44.98
sum: 10021.97
Threads fairness:
events (avg/stddev): 1041.0000/0.00
execution time (avg/stddev): 10.0220/0.00
# sysbench fileio --file-test-mode=seqrewr run
File operations:
reads/s: 0.00
writes/s: 1229.02
fsyncs/s: 1574.44
Throughput:
read, MiB/s: 0.00
written, MiB/s: 19.20
General statistics:
total time: 10.0071s
total number of events: 27929
Latency (ms):
min: 0.00
avg: 0.36
max: 471.49
95th percentile: 0.02
sum: 9997.75
Threads fairness:
events (avg/stddev): 27929.0000/0.00
execution time (avg/stddev): 9.9978/0.00
对于人工小文件,4K 的读取速度似乎快两倍,写入速度快 0.25 倍。
另一次编辑。进行了同样的测试,但复制了 110G 的文件包,大小从 2.5Mb(95%tile)到 300Mb 不等。
512 和 4096 格式化驱动器均耗时 20 分 30 秒 +-4 秒