other:hardware:ssd
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| other:hardware:ssd [2020/01/25 00:35] – rodolico | other:hardware:ssd [2020/01/25 21:06] (current) – rodolico | ||
|---|---|---|---|
| Line 9: | Line 9: | ||
| <code bash> | <code bash> | ||
| apt install smartmontools # Devuan Linux | apt install smartmontools # Devuan Linux | ||
| + | pkg install smartmontools # FreeBSD | ||
| # record number of Logical Bytes that makes up a sector | # record number of Logical Bytes that makes up a sector | ||
| smartctl /dev/sda -a |grep " | smartctl /dev/sda -a |grep " | ||
| Line 30: | Line 31: | ||
| NOTE: some vendors do not include ID 241 in their output, so all you can do is guess. One good thing to try is simply take the output of smartctl -a and pipe it to less, then read through it (not that big). | NOTE: some vendors do not include ID 241 in their output, so all you can do is guess. One good thing to try is simply take the output of smartctl -a and pipe it to less, then read through it (not that big). | ||
| + | |||
| + | ===== Script ===== | ||
| + | |||
| + | The following script is very rough, but kinda works. No parameters, but you have to comment/ | ||
| + | |||
| + | <code perl getSmart.pl> | ||
| + | #! / | ||
| + | |||
| + | use warnings; | ||
| + | use strict; | ||
| + | |||
| + | my %allDrives; | ||
| + | |||
| + | # create a hash with the keys having values ada0, da0, etc | ||
| + | # comment/ | ||
| + | |||
| + | # manually enter the drives to look at | ||
| + | # %allDrives = map { $_ => 0 } qw/ada0 da0 da1 da2 da3 da4 da5 da6 da7 da8 da9/; | ||
| + | # automagically find the drives on a BSD system | ||
| + | %allDrives = map { & | ||
| + | # automagically find the drives on a Linux system | ||
| + | #%allDrives = map { & | ||
| + | |||
| + | sub trim { | ||
| + | my $value = shift; | ||
| + | | ||
| + | | ||
| + | } | ||
| + | |||
| + | sub getTotalWrites { | ||
| + | my $drive = shift; | ||
| + | my @report = `smartctl -a / | ||
| + | | ||
| + | my @temp = grep{ /^Sector Size:/ } @report; | ||
| + | my $sectors = shift @temp; | ||
| + | # print "The Value is [$sectors]\n"; | ||
| + | if ( $sectors =~ m/^Sector Size\: | ||
| + | $sectors = $1; | ||
| + | # print " | ||
| + | @temp = grep{ /^241/ } @report; | ||
| + | my $lbas = $temp[0]; | ||
| + | if ( $lbas =~ m/ | ||
| + | $lbas = $1; | ||
| + | | ||
| + | } else { | ||
| + | | ||
| + | } | ||
| + | } else { | ||
| + | return -4; | ||
| + | } | ||
| + | | ||
| + | } | ||
| + | | ||
| + | # output the drives and information as tab delimited, | ||
| + | foreach my $thisDrive ( sort keys %allDrives ) { | ||
| + | # | ||
| + | | ||
| + | print " | ||
| + | } | ||
| + | </ | ||
| ===== Links ===== | ===== Links ===== | ||
other/hardware/ssd.1579934147.txt.gz · Last modified: 2020/01/25 00:35 by rodolico
