Github repository for FreeNAS scripts, including disk burnin and rsync support

Github repository for FreeNAS scripts, including disk burnin and rsync support

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
I ordered some WD 12TB Elements Desktop Hard Drive, USB 3.0 - WDBWLG0120HBK-NESN that I plan on shucking. In anticipation of their arrival I was wondering if the script will work on external USB 3.0 drives? It would be great to return any defective drives before removing them from the case.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,175
USB shouldn't make any difference, but cooling tends to be horrible with external enclosures.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
Do u think that’s a problem just for the burnin test.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Probably not. You should be fine. That said, USB controller reliability is variable. If you use guitar picks / credit-card-cut-in-four, you can shuck a WD drive without breaking any plastic tabs. I'd say if you're more comfortable that way, burn in with USB; and if that gives you trouble, shuck carefully without breaking tabs, and burn in on a proper SATA/SAS controller.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
I ordered some WD 12TB Elements Desktop Hard Drive, USB 3.0 - WDBWLG0120HBK-NESN that I plan on shucking. In anticipation of their arrival I was wondering if the script will work on external USB 3.0 drives? It would be great to return any defective drives before removing them from the case.
I have never tried to use the burn-in script with USB drives. It may be possible to get smartctl to work with USB drives:

The problem, though, is running badblocks -- I have no idea how to execute badblocks on a USB drive.

I suppose you could use Western Digital's tools to perform at least minimal diagnostics. But I don't believe you'll be able to run the burn-in script without shucking the drive. If you do so, be careful not to damage the shell (as @Yorick suggests above). Then, if you find the drive to be defective, you can re-install it into its case and RMA it.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,175
The problem, though, is running badblocks -- I have no idea how to execute badblocks on a USB drive.
Why would it be any different?
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Why would it be any different?
It wouldn't, if the OS supports the USB drive. You would need to edit the script and modify the device specification accordingly.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
It wouldn't, if the OS supports the USB drive. You would need to edit the script and modify the device specification accordingly.
Could you explain further what line and how to modify it?
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Could you explain further what line and how to modify it?
The call to badblocks is at line 291:
Code:
 badblocks -b 4096 -wsv -o "$BB_File" /dev/"$Drive" 

If a USB disk needs a device specification other than the usual (e.g., /dev/da1), a user would need to modify this line to specify it.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
If a USB disk needs a device specification other than the usual (e.g., /dev/da1), a user would need to modify this line to specify it.

I expect it’ll just be the usual though. /dev/sdX on Linux, and FreeBSD /dev/daX.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
USB shouldn't make any difference, but cooling tends to be horrible with external enclosures.
You are 100% correct. The script worked no problem with the USB drives but the temperatures were getting up to 52 degrees. I didn't want to shorten the drives lifespan so I terminated the script and installled 1/2 the drives in an old computer case and they are running at 35-39 degrees. Will do the other half after the script completes.
 

Muzza

Dabbler
Joined
Jun 17, 2015
Messages
31
Looking for a bit of help with the ups_report.sh . The script reports the day and time (in the email) but no ups info. Running upsc in the shell I find the command upsc -l ups50@localhost:161 returns connection refused but if I omit the -l The command returns lots of data. (ups50@localhost:161 was found in the terminal read out ) >
ASrock upsmon[17024]: Communications with UPS ups50@localhost:161 established


I am not a programmer and just can't find any reference to why this is happening.
Any help would be gratefully appreciated..
Thanks,
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Looking for a bit of help with the ups_report.sh . The script reports the day and time (in the email) but no ups info. Running upsc in the shell I find the command upsc -l ups50@localhost:161 returns connection refused but if I omit the -l The command returns lots of data. (ups50@localhost:161 was found in the terminal read out ) >
ASrock upsmon[17024]: Communications with UPS ups50@localhost:161 established


I am not a programmer and just can't find any reference to why this is happening.
Any help would be gratefully appreciated..
Thanks,
Hmmm.... the only thing you should have to do with this script is specify your email address, which it appears you have done.

When you run upsc with the -l option, you pass it your hostname -- not the UPS name. It will return the name(s) of the UPS system(s) attached to your server.

What do you see when you execute this command? hostname -s
This returns the 'short' version of your system's hostname.

Assuming the above returns localhost, what do you see when you execute this command? upsc -l localhost
(For localhost, use whatever value the hostname -s command returned above.)

It looks like you named your UPS ups50. So running upsc -l localhost should return ups50, and running upsc ups50 should display all of the information available from the UPS.

The script uses the above three commands to produce the report, so if they work at the command line, they should work in the script as well.

Did you make any edits to the script, other than to specify your email address?
 

Muzza

Dabbler
Joined
Jun 17, 2015
Messages
31
Thank you for your assistance...

What do you see when you execute this command? hostname -s - Returns ASrock -Which is correct
what do you see when you execute this command? upsc -l localhost - Returns Error: Connection failure: Connection refused
running upsc ups50 returns Error: Connection failure: Connection refused

root@ASrock:~ # upsc ups50
Error: Connection failure: Connection refused

running root@ASrock:~ # upsc ups50@localhost:161
ambient.humidity: 0.00
ambient.temperature: 0.0
battery.charge: 100.00
battery.charge.low: 20
battery.runtime: 4208.00
battery.runtime.low: 240.00
battery.voltage: 49.00
device.mfr: Eaton
device.model: Eaton 5PX
device.serial: G690G11055
device.type: ups
driver.name: snmp-ups
driver.parameter.pollinterval: 2
driver.parameter.port: 192.168.1.188
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: mge M
driver.version.data: mge MIB 0.5
driver.version.internal: 0.97
input.phases: 1.00
input.transfer.reason:
outlet.desc: Main Outlet
outlet.id: 0
output.current: 1.00
output.frequency: 60.00
output.phases: 1.00
output.voltage: 116.00
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.firmware: 01.02.0002
ups.firmware.aux: JI
ups.load: 10.00
ups.start.auto: yes
ups.status: OL
ups.test.result: done and passed
ups.timer.reboot: -1.00
ups.timer.shutdown: -1.00
ups.timer.start: -1.00


running upsc -l ups50@localhost:161 reports no such host. (lower case L not 1)


I have made no alterations to the script except email address....
Is there anything else I should try?

Thanks...
 
Last edited:

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Thank you for your assistance...

What do you see when you execute this command? hostname -s - Returns ASrock -Which is correct
what do you see when you execute this command? upsc -l localhost - Returns Error: Connection failure: Connection refused
running upsc ups50 returns Error: Connection failure: Connection refused

root@ASrock:~ # upsc ups50
Error: Connection failure: Connection refused

running root@ASrock:~ # upsc ups50@localhost:161
ambient.humidity: 0.00
ambient.temperature: 0.0
battery.charge: 100.00
battery.charge.low: 20
battery.runtime: 4208.00
battery.runtime.low: 240.00
battery.voltage: 49.00
device.mfr: Eaton
device.model: Eaton 5PX
device.serial: G690G11055
device.type: ups
driver.name: snmp-ups
driver.parameter.pollinterval: 2
driver.parameter.port: 192.168.1.188
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: mge M
driver.version.data: mge MIB 0.5
driver.version.internal: 0.97
input.phases: 1.00
input.transfer.reason:
outlet.desc: Main Outlet
outlet.id: 0
output.current: 1.00
output.frequency: 60.00
output.phases: 1.00
output.voltage: 116.00
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.firmware: 01.02.0002
ups.firmware.aux: JI
ups.load: 10.00
ups.start.auto: yes
ups.status: OL
ups.test.result: done and passed
ups.timer.reboot: -1.00
ups.timer.shutdown: -1.00
ups.timer.start: -1.00


running upsc -l ups50@localhost:161 reports no such host. (lower case L not 1)


I have made no alterations to the script except email address....
Is there anything else I should try?

Thanks...
So your hostname is ASrock. What does upsc -l ASrock return?
 

Muzza

Dabbler
Joined
Jun 17, 2015
Messages
31
running upsc -l ASrock returns Error: Connection failure: Connection refused

BTW I'm running 11.3-U4.1

:(
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
running upsc -l ASrock returns Error: Connection failure: Connection refused

BTW I'm running 11.3-U4.1

:(
I'm stumped. You are the first and -- so far -- only user who has had this problem with the ups_report.sh script.

Perhaps it would be helpful if you posted a screenshot of your UPS settings. Is there anything unusual about your UPS configuration?

You said the output of hostname -s on your system gives a hostname of ASrock

But when you run upsc -l ASrock you get a connection failure. That doesn't make sense...

Are you sure the hostname isn't asrock? Case matters on UNIX-style systems.

If ASrock is your hostname, then running upsc -l ASrock should return the UPS device name you configured in FreeNAS. Running the command with 'localhost' as the hostname should do so as well.

Here is the output from my system bandit:
Code:
root@bandit:~/scripts # upsc -l localhost
ups
root@bandit:~/scripts # upsc -l bandit
ups
root@bandit:~/scripts #
You can see that the name of my UPS is: ups

Which brings up another oddity: you get a listing of the UPS variables when you run upsc ups50@localhost:161, i.e., when you specify the UPS ID together with a hostname and port number. This doesn't make any sense, either, as I get the same data just by specifying the UPS ID, like this:
Code:
root@bandit:~/scripts # upsc ups
ambient.1.humidity.alarm.high: 60.00
ambient.1.humidity.alarm.low: 30.00
ambient.1.temperature.alarm.high: 104.00
ambient.1.temperature.alarm.low: 50.00
battery.charge: 100.00
... snip ...
Do you get the same output when you run upsc ups50@ASrock:161?

I'm out of ideas. Perhaps another, more knowledgeable forum user will see this post and help us out.
 

Muzza

Dabbler
Joined
Jun 17, 2015
Messages
31
Yes... ups50@ASrock:161 does indeed produce the data output.
N.B. My hostname is ASrock but just tried asrock with no luck as well.
Screenshot 2020-08-04 000015.jpg
 
Last edited:

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Yes... ups50@ASrock:161 does indeed produce the data output.
N.B. My hostname is ASrock but just tried asrock with no luck as well.
View attachment 40562
As I said before... I have no clue what is going on with your system. I'm curious, though -- how did you know to use port 161 to get data from your UPS?

Anyway, you can always just hard-code the script to work with your particular system. Instead of querying the system for the UPS device(s) it's attached to, we'll just plug in the UPS name.

Edit the script and browse down to roughly line 35. You should see this:
Code:
upslist=$(upsc -l "${freenashost}") 

Replace the line with this:
Code:
upslist="ups50@ASrock:161"
Which should make the script work for you. Good luck.
 
Top