LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Programatically determine if device is in RAID array (https://www.linuxquestions.org/questions/linux-software-2/programatically-determine-if-device-is-in-raid-array-765491/)

anoneironaut 10-30-2009 01:12 AM

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?

-Anon

ShadowCat8 10-30-2009 06:50 PM

Well,

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?

Quote:

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.

HTH.

anoneironaut 11-02-2009 02:37 PM

This only needs to run on RHEL4. Its always going to be software RAID. I'll take a look through those.


All times are GMT -5. The time now is 11:53 PM.