Categories
SysOps

How does Samsung SSD T7 perform on Raspberry Pi

Brief note about Samsung SSD T7 on Raspberry Pi 4 which provided a nice boost to my personal GitLab instance at home. The performance is strongly limited due to Raspberry Pi device constraints, but it is still much better than regular HDD.

Operating system.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

Kernel version.

$ uname -a
Linux raspberrypi 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux

Connect device.

$ dmesg
[...]
[   67.500588] usb 2-2: new SuperSpeed USB device number 2 using xhci_hcd
[   67.520740] usb 2-2: New USB device found, idVendor=04e8, idProduct=4001, bcdDevice= 1.00
[   67.520772] usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[   67.520789] usb 2-2: Product: PSSD T7
[   67.520804] usb 2-2: Manufacturer: Samsung
[   67.520817] usb 2-2: SerialNumber: S5TGNS0RC03342H
[   67.547875] scsi host0: uas
[   67.549446] scsi 0:0:0:0: Direct-Access     Samsung  PSSD T7          0    PQ: 0 ANSI: 6
[   67.551863] sd 0:0:0:0: [sda] 976773168 512-byte logical blocks: (500 GB/466 GiB)
[   67.552053] sd 0:0:0:0: [sda] Write Protect is off
[   67.552071] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[   67.552372] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   67.553082] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes
[   67.588033] sd 0:0:0:0: [sda] Attached SCSI disk
[   67.648863] sd 0:0:0:0: Attached scsi generic sg0 type 0
[...]

List connected devices.

$ lsusb 
Bus 002 Device 002: ID 04e8:4001 Samsung Electronics Co., Ltd PSSD T7
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

List USB device details.

$ sudo lsusb -v -s 002:002
Bus 002 Device 002: ID 04e8:4001 Samsung Electronics Co., Ltd PSSD T7
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.20
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x04e8 Samsung Electronics Co., Ltd
  idProduct          0x4001 
  bcdDevice            1.00
  iManufacturer           2 Samsung
  iProduct                3 PSSD T7
  iSerial                 1 S5TGNS0RC03342H
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0079
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              896mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           4
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     98 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams             32
        Data-in pipe (0x03)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams             32
        Data-out pipe (0x04)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams             32
        Status pipe (0x02)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               0
        Command pipe (0x01)
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x002a
  bNumDeviceCaps          3
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x0000f41e
      BESL Link Power Management (LPM) Supported
    BESL value     1024 us 
    Deep BESL value    61440 us 
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat        2047 micro seconds
  SuperSpeedPlus USB Device Capability:
    bLength                20
    bDescriptorType        16
    bDevCapabilityType     10
    bmAttributes         0x00000001
      Sublink Speed Attribute count 1
      Sublink Speed ID count 0
    wFunctionalitySupport   0x1100
    bmSublinkSpeedAttr[0]   0x000a4030
      Speed Attribute ID: 0 10Gb/s Symmetric RX SuperSpeedPlus
    bmSublinkSpeedAttr[1]   0x000a40b0
      Speed Attribute ID: 0 10Gb/s Symmetric TX SuperSpeedPlus
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x000c
  (Bus Powered)
  U1 Enabled
  U2 Enabled

Perform cached/buffered read on Raspberry Pi 4.

$ sudo hdparm -t -T /dev/sda  
/dev/sda:
 Timing cached reads:   2038 MB in  2.00 seconds = 1020.29 MB/sec
 Timing buffered disk reads: 874 MB in  3.00 seconds = 291.21 MB/sec

Perform cached/buffered read on desktop PC.

$ sudo hdparm -t -T /dev/sda
/dev/sda:
 Timing cached reads:   35130 MB in  2.00 seconds = 17596.74 MB/sec
 Timing buffered disk reads: 2620 MB in  3.02 seconds = 866.55 MB/sec

Perform direct read on Raspberry Pi 4.

$ sudo hdparm -t --direct /dev/sda
/dev/sda:
 Timing O_DIRECT disk reads: 948 MB in  3.00 seconds = 315.85 MB/sec

Perform direct read on desktop PC.

$ sudo hdparm -t --direct /dev/sda
/dev/sda:
 Timing O_DIRECT disk reads: 2036 MB in  3.00 seconds = 678.17 MB/sec

Perform write test using dd on Raspberry Pi 4.

$ sudo dd if=/dev/zero of=/dev/sda bs=256M count=16 oflag=dsync
16+0 records in
16+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 23.6042 s, 182 MB/s

Perform write test using dd on desktop PC.

$ sudo dd if=/dev/zero of=/dev/sda bs=256M count=16 oflag=dsync
16+0 records in
16+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 7.83263 s, 548 MB/s

Perform read test using dd on Raspberry Pi 4.

$ sudo dd if=/dev/sda of=/dev/null bs=256M count=16
16+0 records in
16+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 13.8206 s, 311 MB/s

Perform read test using dd on desktop PC.

$ sudo dd if=/dev/sda of=/dev/null bs=256M count=16
16+0 records in
16+0 records out
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 5.20054 s, 826 MB/s

This is a gnome-disks benchmark on Ubuntu 22.04 which was used as the above-mentioned desktop PC.