hawihoney Posted February 5, 2017 Share Posted February 5, 2017 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 1 Quote Link to comment
hawihoney Posted February 5, 2017 Author Share Posted February 5, 2017 Ok, this one is ok for me: for d in /dev/sd?; do echo "$d " "$(udevadm info --query=all --name=$d|grep ID_SERIAL_SHORT=)"|awk '{if ($1 !~ /\/dev\/sda/){system("smartctl -A "$1" > "$3".txt")}}'; done 1 Quote Link to comment
RobJ Posted February 5, 2017 Share Posted February 5, 2017 Or you could try the "diagnostics" command! In the diagnostics zip is a smart folder containing the SMART reports for all of your drives, correctly named with timestamps. Quote Link to comment
hawihoney Posted February 6, 2017 Author Share Posted February 6, 2017 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 Quote Link to comment
RobJ Posted February 6, 2017 Share Posted February 6, 2017 Yeah, sorry! It has always worked perfectly - except right now with the 6.3 upgrade! A small bug in 6.3, will probably be fixed quickly. Quote Link to comment
Recommended Posts
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.