Opened 3 years ago

Last modified 3 years ago

#737 new defect

Exit code 0 returned even when no SCSI diagnostic data is available

Reported by: cferri Owned by:
Priority: minor Milestone: undecided
Component: smartctl Version: 6.5
Keywords: scsi Cc:

Description (last modified by Christian Franke)

An Exit Code of 0 is returned even when the SMART Data cannot be read. I realise all the bits of the Exit Code are in use, but is there any way that this result could be conveyed easily to the calling routine, perhaps a combination of bits that could not otherwise occur, or maybe all bits set?

Exit code 0

smartctl 6.5 2016-05-07 r4318 [x86_64-w64-mingw32-win10] (sf-6.5-1)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===

Attachments (1)

smartctldb.txt (5.4 KB) - added by cferri 3 years ago.
Debug for device 3

Download all attachments as: .zip

Change History (5)

comment:1 Changed 3 years ago by Christian Franke

Component: allsmartctl
Description: modified (diff)
Keywords: Exit Code removed
Milestone: Release 6.6undecided
Summary: Exit Code 0Exit code 0 returned even when the SMART Data cannot be read
Type: enhancementdefect

If SMART READ DATA has failed, smartctl should return exit code 4.

Please provide a sample debug output as an attachment to this ticket:
smartctl -r ioctl,2 -i -A ...

PS: For future bug reports, please do not set a milestone.

Changed 3 years ago by cferri

Attachment: smartctldb.txt added

Debug for device 3

comment:2 Changed 3 years ago by cferri

Thanks for your reply. I have attached the debug info as requested.
Below is the Powershell code I use to call smartctl.exe and capture the Exit Code. Am I capturing the wrong exit code? If so, how do I get the correct one?

$app = "C:\program files\smartmontools\bin\smartctl.exe"
$arg1 = "/dev/pd" + $DEV
& $app -A $arg1 | Tee-Object -Variable smart | Out-Null
$smartstatus = $LASTEXITCODE

comment:3 Changed 3 years ago by Christian Franke

Keywords: scsi added
Priority: majorminor
Summary: Exit code 0 returned even when the SMART Data cannot be readExit code 0 returned even when no SCSI diagnostic data is available

Thanks for the info. The script looks good.

This is possibly a corner case of the SCSI/SAS part of smartctl (which is very different from the ATA/SATA part): It does not return an error if none of the optional diagnostic info is provided by the device.

Leaving ticket as "undecided" until an SCSI expert has time to look at it.

BTW: It usually does not make much sense to run smartctl on a logical device emulated by a RAID controller. In many cases, the driver/firmware does only emulate basic SCSI INQUIRY/READ/WRITE functionality and does not pass diagnostic info from physical drives to the host.

For possible future HighPoint support under Windows see ticket #645.

comment:4 Changed 3 years ago by cferri

Thanks for the update and glad to know the script is ok.

The full script does more than run smartctl and is used to thoroughly test all the discs on various systems prior to running backup programs. These discs are mainly on USB or SATA but some are on add-in RAID controllers. I have an ini file that is used to pass the parameters to the script, so I suppose I could add a flag to skip smartctl for those discs that aren't compatible just now.

I will keep tabs on #645 for future developments.

Note: See TracTickets for help on using tickets.