Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-30-2009, 01:12 AM   #1
LQ Newbie
Registered: May 2009
Posts: 5

Rep: Reputation: 0
Programatically determine if device is in RAID array

Hey all,

I'm writing a bash script that needs to know whether or not a device node is part of a RAID array. I'm just curious if anyone knows of a good way to determine if a device node is in a RAID array. I know that you can run mdadm -Q or mdadm --examine on the device node and that will tell you. But I don't want to rely on screen scrapping and would rather have something that would return a boolean. Any ideas?

Old 10-30-2009, 06:50 PM   #2
Registered: Nov 2004
Location: San Bernardino, CA
Distribution: Gentoo, Arch, (RedHat4.x-9.x, FedoraCore 1.x-4.x, Debian Potato-Sarge, LFS 6.0, etc.)
Posts: 261

Rep: Reputation: 52

To start with, is this for just one of your boxes, or is this going to be for software that is going out to end-users with 'gawd-knows-what' running on their system?

Originally Posted by anoneironaut
I know that you can run mdadm -Q or mdadm --examine on the device node and that will tell you.
Well, if you were running from a hardware RAID, it might not tell you. To tell what is going on with a 3Ware card, you need to use their tw_cli or 3dm2 interfaces.

I would think that if you are definitely looking for a local software RAID that was set up with mdadm, you may want to see what is created under /sys for the drive/filesystem after setting up a RAID with mdadm and try to key on that.

Old 11-02-2009, 02:37 PM   #3
LQ Newbie
Registered: May 2009
Posts: 5

Original Poster
Rep: Reputation: 0
This only needs to run on RHEL4. Its always going to be software RAID. I'll take a look through those.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Method to determine if a device is a usb device (RHEL5 / RHEL6) mholden64 Linux - Kernel 4 08-15-2009 07:45 PM
how to programatically determine if hyperthreading is enabled in linux kernel shawshank_blr Linux - Kernel 2 07-03-2009 07:14 AM
How to detect programatically if a USB device is is plugged-in / plugged out? franc Linux - Software 3 02-01-2007 04:01 AM
How to determine major, minor programatically markjuggles Programming 1 04-15-2005 01:09 PM
software raid - add device wrongly marked faulty back into array? snoozy Linux - General 2 06-27-2003 02:11 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration