Jump to content
doron

[Plugin] Spin Down SAS Drives

106 posts in this topic Last Reply

Recommended Posts

57 minutes ago, doron said:

I'll use that as a filter in the script, ergo "can work with that".

Probably there are no true non-SAS "SCSI" controllers out there, as in parallel SCSI or Fibre Channel.  I know we don't include any of the parallel scsi drivers into our kernel.  I would think it's safe to assume that any scsi is going to be SAS.

 

The purpose of the 'emhttp_device_scsi_smart' script is to produce the output of 'smartctl -A'.  emhttpd will execute a shell command like this (example device sdb):

"{ /usr/local/sbin/emhttp_device_scsi_smart sdb > /var/local/emhttp/smart/sdb.new ; mv /var/local/emhttp/smart/sdb.new /var/local/emhttp/smart/sdb } &"

What this does is invoke the transport-specific script to use smartctl to output to a 'sdb.new' file.  After this has completed the 'mv' command renames the file from 'sdb.new' to 'sdb'.  In Linux this is atomic; that is, if a process is reading /var/local/emhttp/smart/sdb at the time the 'mv' executes, the process still reads the current file.  When the process closes the file, the vfs layer will then delete it.  Hope this makes sense.

 

Note that those smartctl calls are relatively expensive - meaning, not only do they take a long time to execute, they also totally disrupt any I/O stream taking place to the device.  Typically the driver has to completely flush it's I/O queue, plug incoming I/O requests, execute the sense-mode (or whatever) command to get the SMART data, then finally unplug normal I/O.  This is one reason emhttpd wants to manage spin up/down - because it keeps track of the a device spinning state without having to actually interrogate the device.  (The other reason is to implement spinup groups.)

 

BTW: can you post here a sample output of 'smartctl -A /dev/sdX' of a SAS drive you have?

Share this post


Link to post
22 minutes ago, limetech said:

Probably there are no true non-SAS "SCSI" controllers out there, as in parallel SCSI or Fibre Channel.  I know we don't include any of the parallel scsi drivers into our kernel.  I would think it's safe to assume that any scsi is going to be SAS.

Well, this drive is a SATA SSD:

/dev/disk/by-id/scsi-1ATA_TS120GSSD220S_<redacted>

It is under ESXi though (RDM), so you may think of it as an exception.

 

Quote

Hope this makes sense.

It does. Thanks.

Quote

BTW: can you post here a sample output of 'smartctl -A /dev/sdX' of a SAS drive you have?

Sure, here you go. This is with -A:

smartctl 7.1 2019-12-30 r5022 [x86_64-linux-4.19.107-Unraid] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
Current Drive Temperature:     26 C
Drive Trip Temperature:        85 C

Manufactured in week 36 of year 2018
Specified cycle count over device lifetime:  50000
Accumulated start-stop cycles:  739
Specified load-unload count over device lifetime:  600000
Accumulated load-unload cycles:  16374
Elements in grown defect list: 0

And this is with -a (little a):

smartctl 7.1 2019-12-30 r5022 [x86_64-linux-4.19.107-Unraid] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               HGST
Product:              HUH721212AL4200
Revision:             A3D0
Compliance:           SPC-4
User Capacity:        12,000,138,625,024 bytes [12.0 TB]
Logical block size:   4096 bytes
LU is fully provisioned
Rotation Rate:        7200 rpm
Form Factor:          3.5 inches
Logical Unit id:      0x5000cca2708b9bf8
Serial number:        <redacted>
Device type:          disk
Transport protocol:   SAS (SPL-3)
Local Time is:        Sun Nov 22 02:14:43 2020 IST
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled
Temperature Warning:  Enabled

=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK

Grown defects during certification <not available>
Total blocks reassigned during format <not available>
Total new blocks reassigned <not available>
Power on minutes since format <not available>
Current Drive Temperature:     28 C
Drive Trip Temperature:        85 C

Manufactured in week 36 of year 2018
Specified cycle count over device lifetime:  50000
Accumulated start-stop cycles:  740
Specified load-unload count over device lifetime:  600000
Accumulated load-unload cycles:  16375
Elements in grown defect list: 0

Vendor (Seagate Cache) information
  Blocks sent to initiator = 768214057353216

Error counter log:
           Errors Corrected by           Total   Correction     Gigabytes    Total
               ECC          rereads/    errors   algorithm      processed    uncorrected
           fast | delayed   rewrites  corrected  invocations   [10^9 bytes]  errors
read:          0        0         0         0      60350      60070.756           0
write:         0        0         0         0          7      24002.699           0
verify:        0        0         0         0        811          0.000           0

Non-medium error count:        0

SMART Self-test log
Num  Test              Status                 segment  LifeTime  LBA_first_err [SK ASC ASQ]
     Description                              number   (hours)
# 1  Background long   Completed                   -     148                 - [-   -    -]
# 2  Background short  Completed                   -     128                 - [-   -    -]
# 3  Background short  Completed                   -      22                 - [-   -    -]

Long (extended) Self-test duration: 65535 seconds [1092.2 minutes]

Note that both spin the drive up.

Edited by doron

Share this post


Link to post
16 minutes ago, doron said:

Well, this drive is a SATA SSD:


/dev/disk/by-id/scsi-1ATA_TS120GSSD220S_<redacted>

It is under ESXi though (RDM), so you may think of it as an exception.

 

For those devices it will invoke:

/usr/local/sbin/emhttp_device_scsi-1ATA_<operation>

 

Here is the complete list of transports emhttpd current recognizes:

ata
scsi-SATA
scsi-1ATA
scsi
usb
nvme
virtio

 

20 minutes ago, doron said:

Sure, here you go. This is with -A:

Thanks.  This is consistent with my results from a couple years ago first trying to get SAS spin control to work.  The temperature is being reported correctly.  It's possible before I release that I might get rid of the 'smart' <operation> script callout.

 

22 minutes ago, doron said:

Note that both spin the drive up.

Yup.  Also the '-no standby' seems to work for ATA but not SAS.  This also is handled by emhttpd - that is, it only issues 'smartctl' under these conditions:

  1. the array is Stopped: in this case it's polled every 1 sec
  2. the array is Started and we just detected a spin-up, either by I/O or by explicit spin up commnad: in this case we issue a single smartctl to get the temperature
  3. the array is Started and poll_interval (Settings/Disk Settings) has elapsed.

Share this post


Link to post
2 minutes ago, limetech said:

 

For those devices it will invoke:


/usr/local/sbin/emhttp_device_scsi-1ATA_<operation>

 

Here is the complete list of transports emhttpd current recognizes:

Perfect. Thx.

2 minutes ago, limetech said:

Yup.  Also the '-no standby' seems to work for ATA but not SAS.

Indeed. BTW my plugin installs a wrapper for smartctl which reinstates the "-n standby" thingie (until smartmontools.org fix it).

Share this post


Link to post
8 minutes ago, doron said:

Indeed. BTW my plugin installs a wrapper for smartctl which reinstates the "-n standby" thingie (until smartmontools.org fix it).

I don't think this is necessary.  emhttpd won't invoke smartctl unless device is spinning.

Share this post


Link to post
2 minutes ago, limetech said:

I don't think this is necessary.  emhttpd won't invoke smartctl unless device is spinning.

Could be some other plugins did. It was done out of necessity...

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.