How do smartctl for all attached devices?


Recommended Posts

I'm looking for a combination of linux commands that will find all attached devices, call smartctl for each device and will output a file per device. To make it perfect the name of the file should include the current date and the device identification.

 

I tried the following command but I don't find the identification like "WDC_WD60EFRX-68L0BN1_WD-WX41D95PAC13":

 

lsblk -d -n -oNAME,RO,MODEL | grep sd

 

Any help is highly appreciated.

 

***EDIT:***

 

A little bit further now. Now I need to parse the output and create a smartctl call for every line giving a filename of the ID_SERIAL_SHORT as filename (with awk?):

 

for d in /dev/sd?; do echo "$d" "$(udevadm info --query=all --name=$d|grep ID_SERIAL_SHORT)"; done

 

  • Thanks 1
Link to comment

Diagnostics command tried for the first time --> error. All smartreports do contain the following error:

 

smartctl 6.5 2016-05-07 r4318 [x86_64-linux-4.9.7-unRAID] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

ERROR: smartctl takes ONE device name as the final command-line argument.
You have provided 2 device names:

/dev/sdf

Use smartctl -h to get a usage summary

 

 

Link to comment

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.