Skip to content

CodeGeekR/monitor-Disk-Drive-SSD-TBW

Repository files navigation

๐Ÿค– AI Code Battle: Open Source vs Claude Sonnet 4.5

SSD SMART Monitoring Script Showdown

TL;DR: We tested 4 AI models on generating a macOS SSD monitoring script. Results might surprise you! ๐Ÿ”ฅ

Python macOS License


๐Ÿ“Š The Challenge

Task: Create a Python script that reads and displays complete SSD SMART data on macOS, including:

  • Temperature
  • Total Bytes Written (TBW)
  • Power On Hours
  • Wear Level
  • Media Errors
  • Full SMART output

Models Tested:

  1. ๐Ÿ† Claude Sonnet 4.5 (Anthropic) - Premium AI
  2. ๐Ÿฅˆ Nemotron 3 Nano (NVIDIA) - Open Source
  3. ๐Ÿฅ‰ Qwen3 Coder 30B (Alibaba) - Open Source
  4. ๐Ÿ”ด GPT-OSS-20B (Open Source) - Failed completely
  5. ๐Ÿ”ด Devstral Small 2 (Mistral AI) - Open Source

๐Ÿ† Results Summary

Rank Model Status Key Features Score
๐Ÿฅ‡ 1st Claude Sonnet 4.5 โœ… PERFECT Auto-detect, No sudo needed, Beautiful UI, Smart error handling 10/10
๐Ÿฅˆ 2nd Nemotron 3 Nano โœ… SUCCESS Complete data, Works well, Requires sudo, Fast & Efficient 8.5/10
๐Ÿฅ‰ 3rd Qwen3 Coder 30B โš ๏ธ PARTIAL Functional but poor UX, Hard-coded sudo 6/10
4th GPT-OSS-20B โŒ FAILED No SSD detection, Wrong logic, High GPU usage 1/10
5th Devstral Small 2 โŒ FAILED Wrong device paths, Doesn't understand macOS 2/10

๐Ÿ”ฌ Detailed Analysis

๐Ÿ† 1st Place: Claude Sonnet 4.5 (Premium AI)

Score: 10/10 | View Script

โœ… Auto-detects physical SSDs (filters virtual APFS containers)
โœ… Intelligent sudo handling (tries without, fallback if needed)
โœ… Beautiful formatted output with tables
โœ… Extracts all key metrics:
   โ€ข Temperature: 28ยฐC
   โ€ข TBW: 8,022.20 TB
   โ€ข Power On Hours: 251h (10 days)
   โ€ข Wear Level: 0%
   โ€ข Media Errors: 0
โœ… Complete SMART data dump
โœ… Proper error handling (handles smartctl exit codes)
โœ… Professional code quality

Sample Output:

======================================================================
         SSD SMART REPORT - Complete Diagnostics
======================================================================

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         KEY METRICS SUMMARY                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Critical Warning                                         0x00 (OK) โ”‚
โ”‚  Temperature                                                  28 ยฐC โ”‚
โ”‚  Wear Level                                                      0% โ”‚
โ”‚  TBW (Data Units)                                        8022.20 TB โ”‚
โ”‚  Power On Hours                                 251 hours (10 days) โ”‚
โ”‚  Media Errors                                                     0 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Why it wins: Perfect execution, no sudo needed for the user, beautiful presentation, and enterprise-grade error handling.


๐Ÿฅˆ 2nd Place: Nemotron 3 Nano (Open Source)

Score: 8.5/10 | View Script

โœ… Auto-detects disk (/dev/disk0)
โœ… Shows complete SMART output
โœ… All data visible:
   โ€ข Temperature: 28 Celsius โœ…
   โ€ข Data Units Written: 16,429,485 [8.41 TB] โœ…
   โ€ข Power On Hours: 251 โœ…
   โ€ข All metrics present โœ…
โš ๏ธ  Requires user to run with sudo
โš ๏ธ  No metric extraction (raw output only)
โš ๏ธ  User must read through full output

What it does well:

  • Gets the job done! All data is there and correct
  • Very close to Claude's functionality
  • Clean, readable output
  • Reliable detection

What could be better:

  • Needs manual sudo (user must remember to type "sudo python3 script.py")
  • Doesn't parse metrics into a summary table
  • Less polished UI

Verdict: Impressive performance for an open-source model! Shows that open-source AI is catching up fast. With minor improvements, it could match Claude.

โšก Performance Highlights:

  • Generation Speed: Fast (generated script quickly)
  • Resource Efficiency: Low GPU usage, Mac stayed cool
  • Code Quality: Clean, readable, functional
  • Best Open-Source Model: Clear winner among free alternatives

Comparison with GPT-OSS-20B:

Metric Nemotron 3 Nano GPT-OSS-20B
Speed โšก Fast ๐ŸŒ Very Slow
GPU Usage โœ… Low ๐Ÿ”ฅ High (overheated Mac)
Functionality โœ… Works โŒ Failed
Code Quality โญโญโญโญ โญ

๐Ÿฅ‰ 3rd Place: Qwen3 Coder 30B (Open Source)

Score: 6/10 | View Script

โœ… Functional (works with sudo)
โœ… Retrieves SMART data
โŒ Hard-coded sudo requirement
โŒ No fallback mechanism
โŒ Poor user experience (blocks without sudo)
โŒ Less intelligent permission handling

Verdict: Works but requires significant UX improvements. Not production-ready without modifications.


๐Ÿ”ด 4th Place: GPT-OSS-20B (Open Source)

Score: 1/10 | View Script

โŒ Completely fails to detect SSDs
โŒ Wrong disk detection logic (looks for 'Whole' instead of 'WholeDisk')
โŒ No SSDs detected even with sudo
โŒ High GPU usage during generation (overheated Mac)
โŒ Slow generation time
โŒ Resource inefficient

Error Output:

โš ๏ธ  No SSDs detected.

Performance Issues:

  • Generation time: Very slow compared to Nemotron
  • Resource usage: High GPU load, caused Mac to overheat
  • Efficiency: Worst resource-to-quality ratio

Verdict: Complete failure. The model consumed significant resources during generation but produced non-functional code. Wrong API assumptions (uses entry.get('Whole') instead of checking individual disk properties with WholeDisk).


๐Ÿ”ด 5th Place: Devstral Small 2 (Open Source)

Score: 2/10 | View Script

โŒ Looks for /dev/nvme0 (wrong path for macOS)
โŒ Should use /dev/disk0
โŒ No understanding of macOS disk architecture
โŒ No auto-detection
โŒ Complete failure on macOS

Error Output:

Error: No se encontrรณ un dispositivo NVMe
Prueba manualmente con: sudo smartctl -a /dev/nvme0

Verdict: Fundamental misunderstanding of macOS storage. Would work better on Linux.


๐Ÿ’ก Key Takeaways

๐ŸŽฏ Claude Sonnet 4.5 Advantages:

  1. Intelligence: Understands macOS quirks (APFS virtual containers vs physical disks)
  2. UX Design: Smart sudo handling, beautiful formatting
  3. Error Handling: Handles smartctl's non-zero exit codes correctly
  4. Polish: Production-ready code

๐Ÿš€ Open Source (Nemotron) Wins:

  1. Functionality: Gets all the data correctly
  2. Reliability: Solid detection and output
  3. Efficiency: Fast generation, low resource usage
  4. Performance: Didn't overheat the Mac like GPT-OSS-20B
  5. Cost: Free vs Claude's premium pricing
  6. Gap is closing: 85% of Claude's quality at 0% of the cost

๐Ÿ“ˆ The Open Source Reality:

Nemotron 3 Nano proved that open-source AI can compete with premium models!

Not all open-source models are created equal:

  • โœ… Nemotron 3 Nano: Fast, efficient, functional (85% of Claude's quality)
  • โŒ GPT-OSS-20B: Slow, resource-hungry, non-functional (worst performer)

The gap between paid and open-source AI is narrowing, but model selection matters. Quality open-source models like Nemotron offer excellent value, while others (GPT-OSS-20B) waste resources with poor results.


โšก Performance Comparison

Generation Speed and Efficiency

Model Speed GPU Usage Mac Temperature Result
Nemotron 3 Nano โšกโšกโšก Fast ๐ŸŸข Low โ„๏ธ Cool โœ… Functional
Claude Sonnet 4.5 โšกโšก Normal ๐ŸŸก Medium ๐ŸŒก๏ธ Normal โœ… Perfect
Qwen3 Coder 30B โšก Slow ๐ŸŸก Medium ๐ŸŒก๏ธ Normal โš ๏ธ Works with sudo
GPT-OSS-20B ๐ŸŒ Very Slow ๐Ÿ”ด VERY HIGH ๐Ÿ”ฅ Overheated โŒ Failed
Devstral Small 2 โšก Normal ๐ŸŸข Low โ„๏ธ Cool โŒ Failed

๐Ÿ† Efficiency Winner: Nemotron 3 Nano

Why Nemotron is the best open-source model:

  1. โšก Fastest at generating functional code
  2. ๐ŸŸข Lowest resource consumption (GPU, CPU)
  3. โ„๏ธ Doesn't overheat Mac during generation
  4. โœ… Code that works (unlike GPT-OSS-20B)
  5. ๐Ÿ’ฐ Free with near-Claude performance

โš ๏ธ Worst Efficiency: GPT-OSS-20B

GPT-OSS-20B Issues:

  • ๐ŸŒ Extremely slow generation
  • ๐Ÿ”ฅ High GPU usage โ†’ Mac overheated
  • โŒ Output: non-functional code
  • ๐Ÿ’ธ Waste of resources and time

๐ŸŽฎ Try It Yourself

Claude Sonnet 4.5 (Recommended):

python3 tbw-claude-sonnet-4.5.py

Nemotron 3 Nano (Great open-source alternative):

sudo python3 tbw-nemotron-3-nano.py

Requirements:

# Install smartmontools
brew install smartmontools

# Python 3.7+
python3 --version

๐Ÿ“ธ Screenshots

Click to see Claude Sonnet 4.5 output
======================================================================
         SSD SMART REPORT - Complete Diagnostics
======================================================================

โš ๏ธ  Note: This script may require sudo privileges to access SMART data.
    Trying without sudo first, then with sudo if needed.

======================================================================
  DISK: /dev/disk0
======================================================================

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         KEY METRICS SUMMARY                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Critical Warning                                         0x00 (OK) โ”‚
โ”‚  Temperature                                                  28 ยฐC โ”‚
โ”‚  Wear Level                                                      0% โ”‚
โ”‚  TBW (Data Units)                                        8022.20 TB โ”‚
โ”‚  Host Writes                                            379,822,896 โ”‚
โ”‚  Power On Hours                                 251 hours (10 days) โ”‚
โ”‚  Media Errors                                                     0 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Click to see Nemotron 3 Nano output
=== INFORME SMART COMPLETO ===

SMART/Health Information (NVMe Log 0x02, NSID 0xffffffff)
Critical Warning:                   0x00
Temperature:                        28 Celsius
Available Spare:                    100%
Available Spare Threshold:          99%
Percentage Used:                    0%
Data Units Read:                    40,640,061 [20.8 TB]
Data Units Written:                 16,429,485 [8.41 TB]
Host Read Commands:                 363,638,479
Host Write Commands:                379,824,113
Power Cycles:                       396
Power On Hours:                     251
Media and Data Integrity Errors:    0

๐Ÿค Contributing

Found a bug or want to improve a script? PRs welcome!


๐Ÿ“œ License

MIT License - Feel free to use, modify, and distribute.


๐ŸŒŸ Star This Repo!

If you found this comparison useful, please star the repo! It helps others discover this research.


๐Ÿ”— Related


Made with ๐Ÿค– by AI (and a human who tested them all)

Comparison conducted on macOS 14.6 (Sonoma) with Python 3.14 and smartmontools 7.5

About

Diagnostic tools to calculate TBW on an SSD disk drive

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages