banner
NEWS LETTER

测试磁盘是否为SSD

Scroll down

本地作者;丁辉

测试磁盘是否为SSD

方法一

判断cat /sys/block//queue/rotational的返回值(其中为你的硬盘设备名称,例如sda等等),如果返回1则表示磁盘可旋转,那么就是机械硬盘HDD了;反之,如果返回0,则表示磁盘不可以旋转,那么就有可能是固态硬盘SSD了。

1
grep ^ /sys/block/*/queue/rotational

方式二

  1. 安装sysbench

    1
    yum install -y sysbench
  2. 选择要测的磁盘路径 /opt

    1
    cd /opt
  3. 建文件

    准备阶段:IO测试,线程数为40,创建大小为500M的测试文件64个,共32G,使用了随机读写模式(rndrw)测试300s,执行完后会在当前目录下生成一堆小文件。

    1
    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

    1
    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. 输出结果

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    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万间,吞吐量在300600M/s,可以判定磁盘为SSD。

I'm so cute. Please give me money.

其他文章
cover
测试Linux网络延迟
  • 70/01/01
  • 00:00
  • Linux-Docs
cover
源码升级Gcc
  • 70/01/01
  • 00:00
  • Linux-Docs
目录导航 置顶
  1. 1. 测试磁盘是否为SSD
    1. 1.1. 方法一
    2. 1.2. 方式二
请输入关键词进行搜索