Linux check nvme speed

fio в Linux — измеряем производительность диска

Для замера производительности дисковой системы в Linux есть замечательная утилита fio (Flexible I/O tester). Утилита позволяет использовать для тестирования заранее написанные файл-тесты, в которых указывается что именно мы хотим измерить.

К примеру, можно провести тест на производительность при последовательном и случайном чтении/записи на диск.

Установка fio

Измеряем производительность NVMe диска с помощью fio

Есть сервер Dell PowerEdge R640 с NVMe дисками SSD Dell EMC NVMe 3.84 TB — KCD5XLUG3T84 . В спецификации указаны следующие параметры производительности для данной модели NVMe диска:

  • Последовательное чтение: 3140 MBPS
  • Последовательная запись: 1520 MBPS
  • Случайное чтение: 465000 IOPS
  • Случайная запись: 40000 IOPS

Загружаю на сервере Dell Support Live Image с операционной системой CentOS. Работаю в терминале под рутом. Устанавливаю репозиторий EPEL:

Создаю файл-тест с конфигурацией тестирования, назову его srcmvme0n1 :

# Two RANDOM 4k tests, READ and WRITE
[random_read_4k]
rw=randread
blocksize=4k
filename=/dev/md127
stonewall

# Two SEQUENTIAL 512k tests, READ and WRITE
[seq_read_512k]
rw=read blocksize=512k
filename=/dev/md127
stonewall

Будем проводить четыре теста:

  • Случайное чтение блоками 4k
  • Случайная запись блоками 4k
  • Последовательное чтение блоками 512k
  • Последовательная запись блоками 512k

Процедура тестирования может занять продолжительное время.

Сравню полученные результаты с заявленными в спецификации (в скобках).

  • Последовательное чтение: 2518 (3140) MBPS
  • Последовательная запись: 1583 (1520) MBPS
  • Случайное чтение: 342000 (465000) IOPS
  • Случайная запись: 278000 (40000) IOPS

Чтение чуть меньше заявленного, а запись быстрее. Здесь, скорее всего, сыграло свою роль кэширование и недостаточно большой срок тестирования.

Заключение

Результат моего тестирования не выявил явных проблем с производительностью выбранного NVMe диска. Результаты отличались от заявленных производителем, но следует учесть, что тестируемый диск не новый, тест недолгий, задействован кэш.

Я не самый большой специалист в тестировании дисков и не досконально знаю все возможные опции для настройки файл-теста. Однако, готовые шаблоны можно всегда найти в Интернете.

Читайте также:  How to install rpm in linux

Хотелось бы отметить, что утилитой fio кроме дисков можно проводить тестирование программных и аппаратных массивов.

Если вам понравилась статья, то ставьте 👍🏻 каналу.
Пишите комментарии, задавайте вопросы, подписывайтесь.

Источник

How to Test Disk Speed Using the Linux Command Line?|(Measure Disk Performance with fio,dd and Graphical Method)🏎️

Test Disk Speed Using the Linux Command Line?|(Measure Disk Performance with fio,dd and Graphical Method)

Let’s talk about storage tech and disk speed. The invention of SSD showed everyone just how much difference a faster storage disk can make. And when it comes to speed, there is also the matter of measuring disk speed. You may be interested in testing your PC storage device or perhaps you want to know if your VPS provider actually delivers on their promises of SSD storage — for these and many other reasons, you can use this guide to measure disk speed . Instead of obtaining a single number as ‘speed’, we are interested in measuring what better represents the real-world speed of storage devices such as Hard Disk Drive (HDD), Solid State Drive (SSD), SD cards, and USB memory stick/flash drives, etc. Every storage device provides a certain level of efficiency at a certain financial cost and we’ll run different disk speed tests to discover just how fast each of them is.

As a case in point, HDDs are rather more affordable but also are only appropriate for transferring bulk files to/from disks which has a sequential read/write pattern as opposed to having a random read/write pattern. Accordingly, not every speed measurement method may be good for every disk.

In this article, I will walk you through how to use the “dd”, “hdparm” utility, and “fio” methods to test disk speed in Linux.

We’re also going to cover Linux disk speed test using the Graphical Method. Also, I will be elaborating on why the first two mentioned approaches provide rather poor estimates in certain use cases.

Linux Hosting Simplified

Want a better way to host your websites and web apps? Developing something new? Simply don’t like Windows? That’s why we have Linux VPS.

Test disk speed in Linux using commands

Well, there are multiple approaches to do this and you can use any of them.

Test Disk Speed in Linux using dd

dd is a Linux built-in tool and can be used to generally indicate how much time it takes to complete an operation.

Step 1: Getting Disk Speed Test Result

To obtain a single digit as Write speed of the disk, you are supposed to run the following command and the output will look like the one in the picture below.

use dd to test disk speed

Also, you may use the two following commands to first delete the cached-in temporary file created in a buffer by our previous command, and then to measure the Read speed of the disk.

Step 2: Clearing Cache and Re-testing

test disk speed in linux

If you run the above commands repeatedly, you will see different results. To extract a better result, you can calculate the average of 4 measurements. Yet, the final result is far off the experience a user might have with the disk.

Читайте также:  Git графический интерфейс linux

Test your HDD, SSD Read Speed using Hdparm

“hdparm” is another Linux command-line tool that can be used to derive a sequential read speed of a storage device.

Step 1: Install hdparm

First, you need to install “hdparm” on your Linux, and following that you may run a command to get a digit as the reading speed of the disk.

To install “hdparm” on CentOS, RHEL distributions:

To install “hdparm” on Mint, Ubuntu, Debian:

sudo apt-get install hdparm

Step 2: Run hdparm

Run the hdparm utility by entering the command below into the Linux Terminal

The output should look like this:

Better Test Disk Speed in Linux via fio

The previous benchmarks only account for sequential read/write speed tests. In practice, read/write interaction with the disk more often than not follows a random access pattern. This unqualifies sequential-based methods from estimating the real-world write/read speed of a disk. To overcome this shortcoming, “fio” has been developed.

Please note that speed is basically calculated in MBps. In this method, IOPS (Input/Output operations Per Second) is introduced for the sake of convenience. IOPS is just the same MB/s multiplied by BlockSize/1024, i.e. a bigger digit with the same unit.

Step 1: Install fio

“fio”, which is not available on Linux by default, can be installed easily nonetheless . To install this utility:

Step 2: Run an SSD Disk Speed Test

Let’s first run a basic test with the following specifications:

Data volume: 250MB, Reads: 80% of the whole data, Write: 20% of the whole data

Block Size: 4k, Disk: SSD, Performance Indicators: IOPS and MB/s, Type of test: Random read/write

Test disk speed using fio

The results are as follows:

Step 3: Run an HDD Disk Speed Test

Now let’s run the exact same commands for an HDD:

This random write speed test on HDD shows weaker performance than that of an SSD. Overall, an SSD outperforms an HDD in random access usage and that is why it is more recommended.

The advantage of “fio” is that you can go for sequential reads and writes tests as well. To do that for our HDD, we will need to type in “seqread” and “seqwrite” for – – readwrite.

Linux Hosting Simplified

Want a better way to host your websites and web apps? Developing something new? Simply don’t like Windows? That’s why we have Linux VPS.

Linux Disk Speed Test Using the Graphical Method

You can also use the native Linux Disk utility to perform disk speed tests without entering commands into the Terminal. Here, we’re going to use Ubuntu 21 as an example, but most Linux distros have the same utility.

Читайте также:  Get folder size in linux

Step 1: Open the Disk Utility

You can easily open the Disk Utility by entering the application menu and searching for “Disk” or by finding it in the menu under System → Administration → Disk Utility

Step 2: Select the disk for the test

On the left panel, you’ll see a list of all the disks available on your computer. Select the one you want to test by clicking on it.

Step 3: Run the Benchmark Feature

On the Disk Utility’s right panel, find and click on the ”Benchmark – Measure Drive Performance” button to start Benchmark up.

Step 4: Perform Tests

On the new screen with the chart, you’ll find two buttons. The first one is “Start Read-Only Benchmark” and it does just what it says: measure how fast your disk is when just reading from it. The other one is “Start Read/Write Benchmark” and it measures the speed of both I/O operations, which is bound to be slower. Click on each one in turn or simply select the one you want.

Linux Disk Speed Test Using the Graphical Method

Improving Linux Disk Speed Using NVMe

Linux readily has a built-in tool named dd for measuring disk speed, which is particularly efficient for HDDs speed test as the hard drives are commonly used for large sequential writes and read. However, dd and also “hdparm” are two easy-to-use methods to test disk speed in Linux, they only address sequential access patterns. In other words, they miserably fail to provide a decent speed estimate of disks like SSDs that are used for both large and small files. also, you can read my detailed comparison of NVMe vs SSD.

This is because an SSD can have a random read and write usage. “fio” is a more reliable utility as it mimics the real-world condition for speed test and runs a disk speed test for both random access and large sequential writes and reads. So the next time you purchase a service, make sure you rightly test the throughput to and from your disk so that you do not experience latency.

FAQ

How do I check disk read and write speed in Linux?

You can use different command-line utilities like hdparm and fio, or you can use the graphical GONME application Disk Utility for a disk speed test.

How do I increase disk read speed in Linux?

There are several ways to do that, but without getting into too many technical details, I can say using hdparm with the “–direct” option is a good example since it lets you bypass cache.

What is the command to check disk speed in Linux?

There are three commands for disk speed test in Linux: dd, hdparm, and fio. This article will tell you how to use these commands in the Terminal.

Источник

Оцените статью
Adblock
detector