Test the SSDs in Linux

This page applies to both Linux flows (PetaLinux and Yocto): once the board has booted and you are logged in, the SSDs are tested the same way. The examples were captured on the Yocto images; the PetaLinux images print the same information.

The tools used here are included in the images: lspci (pciutils), nvme (nvme-cli — in all Yocto images and in the Zynq-7000 / Zynq UltraScale+ PetaLinux images; on the Versal PetaLinux images enable it with petalinux-config -c rootfs), fdisk, mkfs.ext4/mke2fs, blkid and dd. The Versal images also carry the single_*_test.sh / dual_*_test.sh speed-test scripts described below. Most of the commands need root privileges: on the Yocto images, prefix them with sudo; on the PetaLinux images, use sudo as the petalinux user.

3. Identify the SSDs with nvme-cli

nvme list
Node                  Generic               SN                   Model                                    Namespace  Usage                      Format           FW Rev
--------------------- --------------------- -------------------- ---------------------------------------- ---------- -------------------------- ---------------- --------
/dev/nvme0n1          /dev/ng0n1            S5P2NU0W........     Samsung SSD 980 PRO 1TB                  0x1         57.40  GB /   1.00  TB    512   B +  0 B   5B2QGXA7
/dev/nvme1n1          /dev/ng1n1            S5P2NU0W........     Samsung SSD 980 PRO 1TB                  0x1        110.93  GB /   1.00  TB    512   B +  0 B   5B2QGXA7

Other useful commands:

nvme id-ctrl /dev/nvme0      # controller identification (model, firmware, capabilities)
nvme smart-log /dev/nvme0n1  # health: temperature, media_errors, num_err_log_entries

A healthy SSD reports critical_warning : 0 and media_errors : 0 in the SMART log.

4. Partition, format and mount

Warning

Partitioning and formatting erase the SSD. Make sure you are working on the right device (/dev/nvme0n1, /dev/nvme1n1, …) and that it holds no data you need.

  1. Create one partition spanning the whole SSD:

    fdisk /dev/nvme0n1
    

    In fdisk, type n (new partition), p (primary), 1, accept the default first and last sectors, then w to write the partition table. (parted is also available in the Yocto images.)

  2. Check that the partition exists with lsblk:

    nvme0n1     259:0    0 931.5G  0 disk
    `-nvme0n1p1 259:1    0 931.5G  0 part
    
  3. Create a file system on it:

    mkfs.ext4 /dev/nvme0n1p1
    
  4. Mount it:

    mkdir -p /mnt/ssd1
    mount /dev/nvme0n1p1 /mnt/ssd1
    

From there you can copy files to and from the SSD like any other disk. Repeat for /dev/nvme1n1 on the designs with two slots. On the PetaLinux images, partitions with a file system on them are also auto-mounted under /run/media/ at the next boot.

5. Measure the throughput

With dd

A simple sequential read of the raw device (read-only, so it does not touch your data):

dd if=/dev/nvme0n1 of=/dev/null bs=1M count=4096 iflag=direct

A sequential write through the file system (to the SSD mounted at /mnt/ssd1 above):

dd if=/dev/zero of=/mnt/ssd1/test.img bs=1M count=2048 oflag=direct conv=fsync
dd if=/mnt/ssd1/test.img of=/dev/null bs=1M iflag=direct
rm /mnt/ssd1/test.img

With the speed-test scripts (Versal images)

The Versal PetaLinux and Yocto images include four scripts in /usr/bin that time a 4 GB (one SSD) or 2 x 4 GB (two SSDs in parallel) transfer to a file on a mounted SSD. Run the write test first: the read test reads back the file that it created.

single_write_test.sh /mnt/ssd1
single_read_test.sh  /mnt/ssd1
dual_write_test.sh   /mnt/ssd1 /mnt/ssd2
dual_read_test.sh    /mnt/ssd1 /mnt/ssd2

Each script prints the amount of data, the elapsed time and the resulting speed in MB/s.

What to expect

Typical figures for a single dd stream (1 MiB blocks, O_DIRECT, one SSD at a time) with a Samsung 980 PRO 1TB on the Yocto images:

Design

Link

Sequential read

Sequential write

ZCU104 (LPC)

Gen3 x1

~610 MB/s

—

ZCU106 HPC1

Gen3 x1

~615 MB/s

~410 MB/s

ZCU106 HPC0

Gen3 x4

700 – 750 MB/s

~585 MB/s

UltraZed-EV

Gen3 x4

790 – 970 MB/s

~585 MB/s

VCK190 FMCP1 / FMCP2

Gen4 x4

1.6 – 2.4 GB/s

925 – 975 MB/s

These numbers are limited by a single dd process on the Arm cores (and, for writes, by the SSD itself), not by the PCIe link: a Gen3 x4 link carries close to 4 GB/s. Running several transfers in parallel (for example both SSDs at once, or several dd processes on different regions of one SSD) gives a higher aggregate. Results also vary between SSD models and with how full the SSD is. On the one-lane designs the x1 link (about 985 MB/s at Gen3) is the limit.

If you measure much lower figures, check the link speed and width as described in step 2 first: a link that trained at Gen1 or with fewer lanes than the design supports points to a hardware or seating problem (see troubleshooting).