[TriLUG] RHEL disks

Scott G. Hall ScottGHall at BellSouth.Net
Tue May 5 17:13:52 EDT 2009


stan briggs wrote:
> i trying to programatically gather information on the disks that are
> installed on two different platforms. the solaris side i can handle
> but the RHEL side i can't quite get to. things like 'fdisk -l' and the
> contents of /proc/partitions give me details that i don't need. i just
> want to list the disks (and their sizes, hopefully) that are currently
> connected to the server.
> 
> any suggestions?

Have you considered 'parted'?  I like to use:
        sudo /sbin/parted /dev/sda print all

(YMMV -- I run this on Debian-based systems, I don't remember where it
   is installed on RHEL, but I know its moved to /usr/sbin/parted in
   Open Solaris.  Also, check your harddisk interfaces: you might need
   to use something like /dev/hda or similar for your system)

I also have an alias for my sysadmins:

alias df='sudo /sbin/parted /dev/sda print all ; echo ""; df -haT'

and I run the same nightly via cron, compare a diff of the parted output
with a saved copy, and if different email it the admin list.

-- 
Scott G. Hall
Raleigh, NC, USA
ScottGHall at BellSouth.Net



More information about the TriLUG mailing list