This commit is contained in:
83
Docs/测试磁盘是否为SSD.md
Normal file
83
Docs/测试磁盘是否为SSD.md
Normal file
@@ -0,0 +1,83 @@
|
||||
> 本地作者;丁辉
|
||||
|
||||
# 测试磁盘是否为SSD
|
||||
|
||||
## 方法一
|
||||
|
||||
> 判断cat /sys/block/*/queue/rotational的返回值(其中*为你的硬盘设备名称,例如sda等等),如果返回1则表示磁盘可旋转,那么就是机械硬盘HDD了;反之,如果返回0,则表示磁盘不可以旋转,那么就有可能是固态硬盘SSD了。
|
||||
|
||||
```bash
|
||||
grep ^ /sys/block/*/queue/rotational
|
||||
```
|
||||
|
||||
## 方式二
|
||||
|
||||
1. 安装sysbench
|
||||
|
||||
```bash
|
||||
yum install -y sysbench
|
||||
```
|
||||
|
||||
2. 选择要测的磁盘路径 /opt
|
||||
|
||||
```bash
|
||||
cd /opt
|
||||
```
|
||||
|
||||
3. 建文件
|
||||
|
||||
> 准备阶段:IO测试,线程数为40,创建大小为500M的测试文件64个,共32G,使用了随机读写模式(rndrw)测试300s,执行完后会在当前目录下生成一堆小文件。
|
||||
|
||||
```bash
|
||||
sysbench --test=fileio --file-total-size=32G --file-test-mode=rndrw --max-time=300 --max-requests=0 --file-block-size=16K --file-num=64 --num-threads=40 prepare
|
||||
```
|
||||
|
||||
4. 测 IO
|
||||
|
||||
```bash
|
||||
sysbench --test=fileio --file-total-size=32G --file-test-mode=rndrw --max-time=300 --max-requests=0 --file-block-size=16K --file-num=64 --num-threads=40 run
|
||||
```
|
||||
|
||||
5. 输出结果
|
||||
|
||||
```bash
|
||||
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
|
||||
WARNING: --num-threads is deprecated, use --threads instead
|
||||
WARNING: --max-time is deprecated, use --time insteadsysbench 1.0.17 (using system LuaJIT 2.0.4)
|
||||
|
||||
Running the test with following options:
|
||||
Number of threads: 40
|
||||
Initializing random number generator from current time
|
||||
|
||||
Extra file open flags: (none)64 files, 512MiB each32GiB total file sizeBlock size 16KiBNumber of IO requests: 0Read/Write ratio for combined random IO test: 1.50Periodic FSYNC enabled, calling fsync() each 100 requests.Calling fsync() at the end of test, Enabled.Using synchronous I/O modeDoing random r/w testInitializing worker threads...
|
||||
|
||||
Threads started!
|
||||
|
||||
File operations:
|
||||
reads/s: 36369.44
|
||||
writes/s: 24246.29
|
||||
fsyncs/s: 38802.60
|
||||
|
||||
Throughput:
|
||||
read, MiB/s: 568.27
|
||||
written, MiB/s: 378.85
|
||||
|
||||
General statistics:
|
||||
total time: 300.0042s
|
||||
total number of events: 29824059
|
||||
|
||||
Latency (ms):
|
||||
min: 0.00
|
||||
avg: 0.37
|
||||
max: 8.21
|
||||
95th percentile: 1.96
|
||||
sum: 11174442.44
|
||||
|
||||
Threads fairness:
|
||||
events (avg/stddev): 745601.4750/1916.86
|
||||
execution time (avg/stddev): 279.3611/0.06
|
||||
```
|
||||
|
||||
6. 解读
|
||||
|
||||
读写次数在2万~4万间,吞吐量在300~600M/s,可以判定磁盘为SSD。
|
Reference in New Issue
Block a user