UFS input/output error

when I try to delete a file, I get an Input/output error.
i tried to use dd and recoverdisk
Code:
root@gimonchik:/home/gimonchik # dd if=/dev/nvme0ns1 of=/dev/null bs=1m
dd: /dev/nvme0ns1: Input/output error
244198+0 records in
244198+0 records out
256060162048 bytes transferred in 198.555689 secs (1289613830 bytes/sec)
Code:
root@gimonchik:/home/gimonchik # recoverdisk /dev/nvme0ns1
Bigsize = 1048576, medsize = 32768, minsize = 512
        start    size     block-len  pass          done     remaining    % done
 256060514304  352256             0     0  256060514304             0  100.0000Completed
 
You need to read the SMART info from the disk.

I think smartctl doesn't work on NVMe drives on FreeBSD at this time, so a Linux boot stick might be required.
 
You need to read the SMART info from the disk.

I think smartctl doesn't work on NVMe drives on FreeBSD at this time, so a Linux boot stick might be required.
I was able to get this smartctl output from my nvme disk. Do you mean smartctl tests not working?


Code:
# smartctl -a /dev/nvme0ns1
smartctl 7.4 2023-08-01 r5530 [FreeBSD 14.2-RELEASE amd64] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       Netac NVMe SSD 256GB
Serial Number:                      **********************
Firmware Version:                   T1202A0
PCI Vendor/Subsystem ID:            0x126f
IEEE OUI Identifier:                0x000001
Controller ID:                      1
NVMe Version:                       1.3
Number of Namespaces:               1
Namespace 1 Size/Capacity:          256,060,514,304 [256 GB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            000001 0000000000
Local Time is:                      Sat Dec 28 18:50:27 2024 +03
Firmware Updates (0x12):            1 Slot, no Reset required
Optional Admin Commands (0x0007):   Security Format Frmw_DL
Optional NVM Commands (0x0015):     Comp DS_Mngmt Sav/Sel_Feat
Log Page Attributes (0x03):         S/H_per_NS Cmd_Eff_Lg
Maximum Data Transfer Size:         64 Pages
Warning  Comp. Temp. Threshold:     83 Celsius
Critical Comp. Temp. Threshold:     85 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     9.00W       -        -    0  0  0  0        0       0

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        40 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    16%
Data Units Read:                    78,524,025 [40.2 TB]
Data Units Written:                 146,190,267 [74.8 TB]
Host Read Commands:                 707,720,921
Host Write Commands:                1,349,618,703
Controller Busy Time:               38,958
Power Cycles:                       2,294
Power On Hours:                     10,684
Unsafe Shutdowns:                   1,129
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0

Error Information (NVMe Log 0x01, 16 of 64 entries)
No Errors Logged

Self-tests not supported
 
Doesn't work for me right now on -current:
Code:
bhyve/freebsd-debug(joker)14% sudo smartctl /dev/nda0
smartctl 7.4 2023-08-01 r5530 [FreeBSD 15.0-CURRENT amd64] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

Smartctl open device: /dev/nda0 failed: INQUIRY failed

I'm not sure why it would behave differently from Linux, but for me it does at this time.
 
Doesn't work for me right now on -current:
Code:
bhyve/freebsd-debug(joker)14% sudo smartctl /dev/nda0
smartctl 7.4 2023-08-01 r5530 [FreeBSD 15.0-CURRENT amd64] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

Smartctl open device: /dev/nda0 failed: INQUIRY failed

I'm not sure why it would behave differently from Linux, but for me it does at this time.
You shouldn't use /dev/nda0 but /dev/nvme0ns1 instead. I don't know why it doesn't work with /dev/nda0 but this works at least for me.
 
You need to read the SMART info from the disk.

I think smartctl doesn't work on NVMe drives on FreeBSD at this time, so a Linux boot stick might be required.
Code:
root@gimonchik:/home/gimonchik # smartctl -a /dev/nvme0ns1
smartctl 7.4 2023-08-01 r5530 [FreeBSD 14.1-RELEASE amd64] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       SAMSUNG MZVLB256HBHQ-000L7
Serial Number:                      S4ELNF1N308453
Firmware Version:                   5M2QEXH7
PCI Vendor/Subsystem ID:            0x144d
IEEE OUI Identifier:                0x002538
Total NVM Capacity:                 256,060,514,304 [256 GB]
Unallocated NVM Capacity:           0
Controller ID:                      4
NVMe Version:                       1.3
Number of Namespaces:               1
Namespace 1 Size/Capacity:          256,060,514,304 [256 GB]
Namespace 1 Utilization:            141,636,313,088 [141 GB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            002538 8301c52e6f
Local Time is:                      Sat Dec 28 19:12:26 2024 MSK
Firmware Updates (0x16):            3 Slots, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x005f):     Comp Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
Log Page Attributes (0x03):         S/H_per_NS Cmd_Eff_Lg
Maximum Data Transfer Size:         512 Pages
Warning  Comp. Temp. Threshold:     84 Celsius
Critical Comp. Temp. Threshold:     85 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     8.00W       -        -    0  0  0  0        0       0
 1 +     6.30W       -        -    1  1  1  1        0       0
 2 +     3.50W       -        -    2  2  2  2        0       0
 3 -   0.0760W       -        -    3  3  3  3      210    1200
 4 -   0.0050W       -        -    4  4  4  4     2000    8000

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        31 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    1%
Data Units Read:                    12,101,629 [6.19 TB]
Data Units Written:                 10,554,743 [5.40 TB]
Host Read Commands:                 153,807,543
Host Write Commands:                153,058,475
Controller Busy Time:               459
Power Cycles:                       1,084
Power On Hours:                     2,166
Unsafe Shutdowns:                   170
Media and Data Integrity Errors:    0
Error Information Log Entries:      2,734
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               31 Celsius
Temperature Sensor 2:               30 Celsius

Error Information (NVMe Log 0x01, 16 of 64 entries)
No Errors Logged

Self-test Log (NVMe Log 0x06)
Self-test status: No self-test in progress
Num  Test_Description  Status                       Power_on_Hours  Failing_LBA  NSID Seg SCT Code
 0   Extended          Completed without error                2166            -     -   -   -    -
 1   Extended          Completed without error                2034            -     -   -   -    -
 
On FreeBSD, we can use nvmecontrol(8).
You can see drive error log on page 0x01 of logpage subcommand,
and health/SMART data on page 0x02 of logpage subcommand.

Some samples of outputs below. (Hidden serial No. by hand.)

Code:
# nvmecontrol identify nvme0
Controller Capabilities/Features
================================
Vendor ID:                   144d
Subsystem Vendor ID:         144d
Serial Number:               ***************
Model Number:                Samsung SSD 970 EVO Plus 2TB
Firmware Version:            1B2QEXM7
Recommended Arb Burst:       2
IEEE OUI Identifier:         00 25 38
Multi-Path I/O Capabilities: Not Supported
Max Data Transfer Size:      2097152 bytes
Sanitize Crypto Erase:       Not Supported
Sanitize Block Erase:        Not Supported
Sanitize Overwrite:          Not Supported
Sanitize NDI:                Not Supported
Sanitize NODMMAS:            Undefined
Controller ID:               0x0004
Version:                     1.3.0
Traffic Based Keep Alive:    Not Supported
Controller Type:             Not Reported
Keep Alive Timer             Not Supported
Maximum Outstanding Commands Not Specified

Admin Command Set Attributes
============================
Security Send/Receive:       Supported
Format NVM:                  Supported
Firmware Activate/Download:  Supported
Namespace Management:        Not Supported
Device Self-test:            Supported
Directives:                  Not Supported
NVMe-MI Send/Receive:        Not Supported
Virtualization Management:   Not Supported
Doorbell Buffer Config:      Not Supported
Get LBA Status:              Not Supported
Sanitize:                    Not Supported
Abort Command Limit:         8
Async Event Request Limit:   4
Number of Firmware Slots:    3
Firmware Slot 1 Read-Only:   No
Per-Namespace SMART Log:     Yes
Error Log Page Entries:      64
Number of Power States:      5
Total NVM Capacity:          2000398934016 bytes
Unallocated NVM Capacity:    0 bytes
Firmware Update Granularity: 00 (Not Reported)
Host Buffer Preferred Size:  0 bytes
Host Buffer Minimum Size:    0 bytes

NVM Command Set Attributes
==========================
Submission Queue Entry Size
  Max:                       64
  Min:                       64
Completion Queue Entry Size
  Max:                       16
  Min:                       16
Number of Namespaces:        1
Compare Command:             Supported
Write Uncorrectable Command: Supported
Dataset Management Command:  Supported
Write Zeroes Command:        Supported
Save Features:               Supported
Reservations:                Not Supported
Timestamp feature:           Supported
Verify feature:              Not Supported
Fused Operation Support:     Not Supported
Format NVM Attributes:       Crypto Erase, Per-NS Erase, All-NVM Format
Volatile Write Cache:        Present

NVM Subsystem Name:

Code:
# nvmecontrol identify /dev/nvme0ns1
Size:                        3907029168 blocks
Capacity:                    3907029168 blocks
Utilization:                 3701217904 blocks
Thin Provisioning:           Not Supported
Number of LBA Formats:       1
Current LBA Format:          LBA Format #00
Metadata Capabilities
  Extended:                  Not Supported
  Separate:                  Not Supported
Data Protection Caps:        Not Supported
Data Protection Settings:    Not Enabled
Multi-Path I/O Capabilities: Not Supported
Reservation Capabilities:    Not Supported
Format Progress Indicator:   0% remains
Deallocate Logical Block:    Read Not Reported
Optimal I/O Boundary:        0 blocks
NVM Capacity:                2000398934016 bytes
Globally Unique Identifier:  00000000000000000000000000000000
IEEE EUI64:                  002538559150bdd9
LBA Format #00: Data Size:   512  Metadata Size:     0  Performance: Best

Code:
# nvmecontrol logpage -p 1 nvme0                               
Error Information Log
=====================
No error entries found
# nvmecontrol logpage -p 1 nvme0ns1
nvmecontrol: log page 1 valid only at controller level

Code:
# nvmecontrol logpage -p 2 nvme0       
SMART/Health Information Log
============================
Critical Warning State:         0x00
 Available spare:               0
 Temperature:                   0
 Device reliability:            0
 Read only:                     0
 Volatile memory backup:        0
Temperature:                    321 K, 47.85 C, 118.13 F
Available spare:                100
Available spare threshold:      10
Percentage used:                31
Data units (512,000 byte) read: 321208674
Data units written:             1050393867
Host read commands:             7503628121
Host write commands:            12069586331
Controller busy time (minutes): 38913
Power cycles:                   2278
Power on hours:                 45927
Unsafe shutdowns:               2007
Media errors:                   0
No. error info log entries:     34186
Warning Temp Composite Time:    0
Error Temp Composite Time:      0
Temperature Sensor 1:           321 K, 47.85 C, 118.13 F
Temperature Sensor 2:           331 K, 57.85 C, 136.13 F
Temperature 1 Transition Count: 0
Temperature 2 Transition Count: 0
Total Time For Temperature 1:   0
Total Time For Temperature 2:   0
 
On FreeBSD, we can use nvmecontrol(8).
You can see drive error log on page 0x01 of logpage subcommand,
and health/SMART data on page 0x02 of logpage subcommand.

Some samples of outputs below. (Hidden serial No. by hand.)

Code:
# nvmecontrol identify nvme0
Controller Capabilities/Features
================================
Vendor ID:                   144d
Subsystem Vendor ID:         144d
Serial Number:               ***************
Model Number:                Samsung SSD 970 EVO Plus 2TB
Firmware Version:            1B2QEXM7
Recommended Arb Burst:       2
IEEE OUI Identifier:         00 25 38
Multi-Path I/O Capabilities: Not Supported
Max Data Transfer Size:      2097152 bytes
Sanitize Crypto Erase:       Not Supported
Sanitize Block Erase:        Not Supported
Sanitize Overwrite:          Not Supported
Sanitize NDI:                Not Supported
Sanitize NODMMAS:            Undefined
Controller ID:               0x0004
Version:                     1.3.0
Traffic Based Keep Alive:    Not Supported
Controller Type:             Not Reported
Keep Alive Timer             Not Supported
Maximum Outstanding Commands Not Specified

Admin Command Set Attributes
============================
Security Send/Receive:       Supported
Format NVM:                  Supported
Firmware Activate/Download:  Supported
Namespace Management:        Not Supported
Device Self-test:            Supported
Directives:                  Not Supported
NVMe-MI Send/Receive:        Not Supported
Virtualization Management:   Not Supported
Doorbell Buffer Config:      Not Supported
Get LBA Status:              Not Supported
Sanitize:                    Not Supported
Abort Command Limit:         8
Async Event Request Limit:   4
Number of Firmware Slots:    3
Firmware Slot 1 Read-Only:   No
Per-Namespace SMART Log:     Yes
Error Log Page Entries:      64
Number of Power States:      5
Total NVM Capacity:          2000398934016 bytes
Unallocated NVM Capacity:    0 bytes
Firmware Update Granularity: 00 (Not Reported)
Host Buffer Preferred Size:  0 bytes
Host Buffer Minimum Size:    0 bytes

NVM Command Set Attributes
==========================
Submission Queue Entry Size
  Max:                       64
  Min:                       64
Completion Queue Entry Size
  Max:                       16
  Min:                       16
Number of Namespaces:        1
Compare Command:             Supported
Write Uncorrectable Command: Supported
Dataset Management Command:  Supported
Write Zeroes Command:        Supported
Save Features:               Supported
Reservations:                Not Supported
Timestamp feature:           Supported
Verify feature:              Not Supported
Fused Operation Support:     Not Supported
Format NVM Attributes:       Crypto Erase, Per-NS Erase, All-NVM Format
Volatile Write Cache:        Present

NVM Subsystem Name:

Code:
# nvmecontrol identify /dev/nvme0ns1
Size:                        3907029168 blocks
Capacity:                    3907029168 blocks
Utilization:                 3701217904 blocks
Thin Provisioning:           Not Supported
Number of LBA Formats:       1
Current LBA Format:          LBA Format #00
Metadata Capabilities
  Extended:                  Not Supported
  Separate:                  Not Supported
Data Protection Caps:        Not Supported
Data Protection Settings:    Not Enabled
Multi-Path I/O Capabilities: Not Supported
Reservation Capabilities:    Not Supported
Format Progress Indicator:   0% remains
Deallocate Logical Block:    Read Not Reported
Optimal I/O Boundary:        0 blocks
NVM Capacity:                2000398934016 bytes
Globally Unique Identifier:  00000000000000000000000000000000
IEEE EUI64:                  002538559150bdd9
LBA Format #00: Data Size:   512  Metadata Size:     0  Performance: Best

Code:
# nvmecontrol logpage -p 1 nvme0                              
Error Information Log
=====================
No error entries found
# nvmecontrol logpage -p 1 nvme0ns1
nvmecontrol: log page 1 valid only at controller level

Code:
# nvmecontrol logpage -p 2 nvme0      
SMART/Health Information Log
============================
Critical Warning State:         0x00
 Available spare:               0
 Temperature:                   0
 Device reliability:            0
 Read only:                     0
 Volatile memory backup:        0
Temperature:                    321 K, 47.85 C, 118.13 F
Available spare:                100
Available spare threshold:      10
Percentage used:                31
Data units (512,000 byte) read: 321208674
Data units written:             1050393867
Host read commands:             7503628121
Host write commands:            12069586331
Controller busy time (minutes): 38913
Power cycles:                   2278
Power on hours:                 45927
Unsafe shutdowns:               2007
Media errors:                   0
No. error info log entries:     34186
Warning Temp Composite Time:    0
Error Temp Composite Time:      0
Temperature Sensor 1:           321 K, 47.85 C, 118.13 F
Temperature Sensor 2:           331 K, 57.85 C, 136.13 F
Temperature 1 Transition Count: 0
Temperature 2 Transition Count: 0
Total Time For Temperature 1:   0
Total Time For Temperature 2:   0
Code:
nvmecontrol identify nvme0
Controller Capabilities/Features
================================
Vendor ID:                   144d
Subsystem Vendor ID:         144d
Serial Number:               S4ELNF1N308453
Model Number:                SAMSUNG MZVLB256HBHQ-000L7
Firmware Version:            5M2QEXH7
Recommended Arb Burst:       2
IEEE OUI Identifier:         00 25 38
Multi-Path I/O Capabilities: Not Supported
Max Data Transfer Size:      2097152 bytes
Sanitize Crypto Erase:       Supported
Sanitize Block Erase:        Supported
Sanitize Overwrite:          Not Supported
Sanitize NDI:                Not Supported
Sanitize NODMMAS:            Undefined
Controller ID:               0x0004
Version:                     1.3.0

Admin Command Set Attributes
============================
Security Send/Receive:       Supported
Format NVM:                  Supported
Firmware Activate/Download:  Supported
Namespace Management:        Not Supported
Device Self-test:            Supported
Directives:                  Not Supported
NVMe-MI Send/Receive:        Not Supported
Virtualization Management:   Not Supported
Doorbell Buffer Config:      Not Supported
Get LBA Status:              Not Supported
Sanitize:                    crypto, block,
Abort Command Limit:         8
Async Event Request Limit:   4
Number of Firmware Slots:    3
Firmware Slot 1 Read-Only:   No
Per-Namespace SMART Log:     Yes
Error Log Page Entries:      64
Number of Power States:      5
Total NVM Capacity:          256060514304 bytes
Unallocated NVM Capacity:    0 bytes
Firmware Update Granularity: 00 (Not Reported)
Host Buffer Preferred Size:  0 bytes
Host Buffer Minimum Size:    0 bytes

NVM Command Set Attributes
==========================
Submission Queue Entry Size
  Max:                       64
  Min:                       64
Completion Queue Entry Size
  Max:                       16
  Min:                       16
Number of Namespaces:        1
Compare Command:             Supported
Write Uncorrectable Command: Supported
Dataset Management Command:  Supported
Write Zeroes Command:        Supported
Save Features:               Supported
Reservations:                Not Supported
Timestamp feature:           Supported
Verify feature:              Not Supported
Fused Operation Support:     Not Supported
Format NVM Attributes:       Crypto Erase, Per-NS Erase, Per-NS Format
Volatile Write Cache:        Present

NVM Subsystem Name:
Code:
# nvmecontrol identify nvme0ns1
Size:                        500118192 blocks
Capacity:                    500118192 blocks
Utilization:                 276633424 blocks
Thin Provisioning:           Not Supported
Number of LBA Formats:       1
Current LBA Format:          LBA Format #00
Metadata Capabilities
  Extended:                  Not Supported
  Separate:                  Not Supported
Data Protection Caps:        Not Supported
Data Protection Settings:    Not Enabled
Multi-Path I/O Capabilities: Not Supported
Reservation Capabilities:    Not Supported
Format Progress Indicator:   0% remains
Deallocate Logical Block:    Read Not Reported
Optimal I/O Boundary:        0 blocks
NVM Capacity:                256060514304 bytes
Globally Unique Identifier:  00000000000000000000000000000000
IEEE EUI64:                  0025388301c52e6f
LBA Format #00: Data Size:   512  Metadata Size:     0  Performance: Best
Code:
# nvmecontrol logpage -p 2 nvme0
SMART/Health Information Log
============================
Critical Warning State:         0x00
 Available spare:               0
 Temperature:                   0
 Device reliability:            0
 Read only:                     0
 Volatile memory backup:        0
Temperature:                    315 K, 41.85 C, 107.33 F
Available spare:                100
Available spare threshold:      10
Percentage used:                1
Data units (512,000 byte) read: 12101958
Data units written:             10555118
Host read commands:             153812697
Host write commands:            153063568
Controller busy time (minutes): 459
Power cycles:                   1084
Power on hours:                 2167
Unsafe shutdowns:               170
Media errors:                   0
No. error info log entries:     2734
Warning Temp Composite Time:    0
Error Temp Composite Time:      0
Temperature Sensor 1:           315 K, 41.85 C, 107.33 F
Temperature Sensor 2:           314 K, 40.85 C, 105.53 F
Temperature 1 Transition Count: 0
Temperature 2 Transition Count: 0
Total Time For Temperature 1:   0
Total Time For Temperature 2:   0
 
Hm, no media error reported.

Return to top post.
Does it work if you specify if=/dev/nda0 instead of if=/dev/nvme0ns1?

And as cracauer noted, me too try cleaning the connector of the SSD and slot it is connected to if the above does not work.
Usually, removing and re-inserting several time would help if not-so-severe rusts (oxydation) or dusts/smokes/mists are hurting electric connectivity.
 
Hm, no media error reported.

Return to top post.
Does it work if you specify if=/dev/nda0 instead of if=/dev/nvme0ns1?

And as cracauer noted, me too try cleaning the connector of the SSD and slot it is connected to if the above does not work.
Usually, removing and re-inserting several time would help if not-so-severe rusts (oxydation) or dusts/smokes/mists are hurting electric connectivity.
Code:
# dd if=/dev/nda0 of=/dev/null bs=1m
244198+1 records in
244198+1 records out
256060514304 bytes transferred in 181.730915 secs (1409009109 bytes/sec)
Code:
# recoverdisk /dev/nda0
Bigsize = 1048576, medsize = 32768, minsize = 512
        start    size     block-len  pass          done     remaining    % done
 256060514304  352256             0     0  256060514304             0  100.0000Completed
Nothing has changed.
 
Code:
# dd if=/dev/nda0 of=/dev/null bs=1m
244198+1 records in
244198+1 records out
256060514304 bytes transferred in 181.730915 secs (1409009109 bytes/sec)
Code:
# recoverdisk /dev/nda0
Bigsize = 1048576, medsize = 32768, minsize = 512
        start    size     block-len  pass          done     remaining    % done
 256060514304  352256             0     0  256060514304             0  100.0000Completed
Nothing has changed.
Hm, but here dd(1) doesn't seem to expose Input/output error.
 
Back
Top