Subversion Repositories sysadmin_scripts

Rev

Rev 155 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 155 Rev 173
Line -... Line 1...
-
 
1
# getDriveInfo
-
 
2
 
1
Scans all hard drives on Unix systems, using smartctl to determine parameters
3
Scans all hard drives on Unix systems, using smartctl to determine parameters
2
like make/model, serial number, hours uptime, etc...
4
like make/model, serial number, hours uptime, etc... and sends a tab
-
 
5
delimited report to STDOUT
3
 
6
 
4
Looks for file /etc/drive_bays and, if it exists, populates the physical bay
7
Looks for file /etc/drive_bays and, if it exists, populates the physical bay
5
a drive in.
8
a drive in.
6
 
9
 
7
Looks for the following binaries and uses if they exist. Will not fail if the
10
Looks for the following binaries and uses if they exist. Will not fail if the
8
binaries do not exist.
11
binaries do not exist.
9
 
12
 
10
== FreeBSD
13
- FreeBSD
11
geom
14
  - geom
12
glabel
15
  - glabel
13
== Linux
16
- Linux
14
lsblk
17
  - lsblk
15
mdadm
18
  - mdadm
16
== All systems
19
- All systems
17
zpool
20
  - zpool
18
smartctl
21
  - smartctl
19
 
-
 
20
uses Perl library JSON if it is available
22
  - uses Perl library JSON if it is available
21
 
23
 
22
Tested on Devuan Linux and FreeBSD
24
Tested on Devuan Linux and FreeBSD
-
 
25
 
-
 
26
### Utilities
-
 
27
 
-
 
28
findmissing is a simple Perl script to use if you have run this program and
-
 
29
populated it with the bays the drives are in. I wrote this to handle a
-
 
30
situation where I know a drive has failed, but I have no bloody idea which
-
 
31
one it is in.
-
 
32
 
-
 
33
It will look for all drives on the system, grab the serial numbers, then
-
 
34
compare that list with [/usr/local]/etc/drive_bays,
-
 
35
[/usr/local]/etc/drives.tsv or what is sent in via STDIN (usually a pipe).
-
 
36
It wil then simpy dump the line which does NOT match.
23
 
37