GithubHelp home page GithubHelp logo

shd's Introduction

Show pretty HDD/SSD list

Long time ago when I've switched from Solaris to Linux, I missed the "hd" utility. In Linux "hd" command is used for hex dump, in Solaris it displayed a pretty table with HDD info.

I had written "shd" shell script with a similar functionality. After I rewrote it in Python, added options and pretty colors. The current version 0.1 comes in Rust, as statically built binaries for x86_64 Linux, i686, ARM and AARCH64.

Installation

Install smartmontools (>=7.0), then download the appropriate binary from the releases page, chmod +x and enjoy.

Usage

shd [-h] [--temp-warn TEMP] [--temp-crit TEMP] [-R] [-y] [-e] [-s] [-f]

  --temp-warn TEMP  Warning temperature, default: 40 C
  --temp-crit TEMP  Critical temperature, default: 45 C
  -f, --fahrenheit  Temperature in Fahrenheit
  -R, --raw         Suppress colors
  -y, --full        Display full disk info
  -e, --errors      Display only disks with errors / critical temperature
  -s, --no-header   Suppress header

Exit codes

  • 1 critical temperature
  • 2 errors detected
  • 3 smartctl error

The tool considers a drive has errors if its smart status is either not reported or reported as passed=false.

shd's People

Contributors

dependabot[bot] avatar divi255 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

shd's Issues

Unable to get device /dev/nvme1 info

When invoking shd on my machine I get thrown the following error:

ewout@enthoo ~ % sudo shd -y
: /dev/nvme1Unable to get device /dev/nvme1 info: EOF while parsing a value at line 1 column 0
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', src/main.rs:225:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

My machine uses the following disk layout:

ewout@enthoo ~ % lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda             8:0    1 119,2G  0 disk
├─sda1          8:1    1   512M  0 part
└─sda2          8:2    1 118,7G  0 part
  └─cryptlvm  254:2    0 118,7G  0 crypt
sdb             8:16   1   1,8T  0 disk
└─sdb1          8:17   1   1,8T  0 part
  └─crypthdd  254:3    0   1,8T  0 crypt
nvme0n1       259:0    0 931,5G  0 disk
├─nvme0n1p1   259:1    0   512M  0 part  /boot
└─nvme0n1p2   259:2    0   931G  0 part
  └─cryptroot 254:0    0   931G  0 crypt /
nvme1n1       259:3    0 119,2G  0 disk
└─nvme1n1p1   259:4    0    20G  0 part
  └─cryptswap 254:1    0    20G  0 crypt [SWAP]

/dev/sda property 'temperature' of 'Device' object has no setter

OS: Fedora 39
Python 3.12

# shd -y
: /dev/nvme0 property 'temperature' of 'Device' object has no setter
Traceback (most recent call last):
  File "/usr/local/bin/shd", line 110, in <module>
    dev.temperature = ''
    ^^^^^^^^^^^^^^^

fix it by

        try:
            dev.temperature = c2f(dev.temperature, a.fh)
        except:
            pass

Invalid Syntax

Ubuntu 18.04 LTS on WSL

Error received after installing with pip:

File "/usr/local/bin/shd", line 97 print(': {} '.format(colored(devpath, color='cyan')), end='') ^ SyntaxError: invalid syntax

rust lib osstring_ascii build failure

Cargo build log:

`error[E0658]: arbitrary expressions in key-value attributes are unstable
 --> /home/josh/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.0.0-beta.4/src/lib.rs:8:10
  |
8 | #![doc = include_str!("../README.md")]
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #78835 <https://github.com/rust-lang/rust/issues/78835> for more information

error[E0658]: use of unstable library feature 'osstring_ascii'
   --> /home/josh/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.0.0-beta.4/src/parse/matches/matched_arg.rs:130:19
    |
130 |                 v.eq_ignore_ascii_case(val)
    |                   ^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #70516 <https://github.com/rust-lang/rust/issues/70516> for more information

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
error: could not compile `clap`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed'``

NVMe SSD - No capacity

My NVMe SSD shows no information about capacity:

# shd -y 
 Disk  Model                      Serial             Temp   PoH  LCC  Int   SSD  Capacity  RRate  Firmware
------------------------------------------------------------------------------------------------------------
nvme0  TOSHIBA-RC100              48UPC172PW6S       38 C             nvme  ssd                   ADRA0101  
 sdb                                                                                                        
 sda   SK hynix SC311 SATA 256GB  MJ8BN05451080BB57  27 C  2190       sat   ssd    256 GB         70000P10 

Here's the smartctl output for that drive:

# smartctl -a /dev/nvme0
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.5.4-arch1-1] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       TOSHIBA-RC100
Serial Number:                      48UPC172PW6S
Firmware Version:                   ADRA0101
PCI Vendor/Subsystem ID:            0x1179
IEEE OUI Identifier:                0x00080d
Controller ID:                      0
Number of Namespaces:               1
Namespace 1 Size/Capacity:          240.057.409.536 [240 GB]
Namespace 1 Formatted LBA Size:     512
Namespace 1 IEEE EUI-64:            00080d 040010b795
Local Time is:                      Thu Feb 20 19:09:34 2020 CET
Firmware Updates (0x12):            1 Slot, no Reset required
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x0017):     Comp Wr_Unc DS_Mngmt Sav/Sel_Feat
Maximum Data Transfer Size:         512 Pages
Warning  Comp. Temp. Threshold:     82 Celsius
Critical Comp. Temp. Threshold:     85 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     3.30W       -        -    0  0  0  0        0       0
 1 +     2.70W       -        -    1  1  1  1        0       0
 2 +     2.30W       -        -    2  2  2  2        0       0
 3 -   0.0500W       -        -    4  4  4  4    10000   45000
 4 -   0.0050W       -        -    4  4  4  4    10000   50000

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 -    4096       0         0
 1 +     512       0         3

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        41 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    16%
Data Units Read:                    18.438.094 [9,44 TB]
Data Units Written:                 14.391.760 [7,36 TB]
Host Read Commands:                 194.036.412
Host Write Commands:                77.343.399
Controller Busy Time:               2.774
Power Cycles:                       1.184
Power On Hours:                     914
Unsafe Shutdowns:                   229
Media and Data Integrity Errors:    0
Error Information Log Entries:      2.170
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               41 Celsius
Thermal Temp. 1 Transition Count:   640
Thermal Temp. 2 Transition Count:   220
Thermal Temp. 1 Total Time:         11776
Thermal Temp. 2 Total Time:         251

Error Information (NVMe Log 0x01, max 64 entries)
No Errors Logged

I know it's not a SATA SSD and the information you get from smartmontools have to be interpreted differently then, but maybe you could integrate that too?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.