shairontoledo / hdinfo-linux

Gets infomation about your hds SATA, IDE or Mass storage for Linux

This URL has Read+Write access

name age message
file README.textile Mon Dec 29 16:07:46 -0800 2008 [shairontoledo]
file hdinfo-0.3.gem Mon Dec 29 15:47:52 -0800 2008 Initial files [shairontoledo]
file hdinfo.c Mon Dec 29 15:47:52 -0800 2008 Initial files [shairontoledo]
file hdinfo.gemspec Mon Dec 29 15:47:52 -0800 2008 Initial files [shairontoledo]
README.textile

This code gets information manufacturer’s about hard disks. This code runs only on Linux.

Add more information if you need, I used the lib ‘linux/hdreg’ take a look it for more details

Installation

First all, you need the packages to compile it.

  • ruby-dev
  • kernel-headers
  • libc6-dev
  • linux-libc-dev
  • gcc (of course)

Make the manual installation downloading the last gem version hdinfo-0.3.gem.
Install the gem with root privileges

sudo gem install hdinfo-0.3.gem

Simple use

The class HdInfo extends Hash so you can do this

require ‘HdInfo’ HdInfo.new(‘/dev/sda’).each { |k,v| puts “#{k} = ‘#{v}’” }

Generates this output

serial_no = ’0881J1FX406355" fw_rev = ‘TW100-11"’ device_name = ‘/dev/sda’ model = ‘SAMSUNG SP0411N’