Re: Detecting array parameters
From: Piergiorgio Sartor <hidden>
Date: 2010-06-12 09:59:53
Hi, thanks for the answer. By "both sides" I mean the "mdadm -D/-E" (one) and the /sys/class/block/mdX/md (the other). Some information is available with "mdadm -D", some other is available in the sysfs. bye, pg On Thu, Jun 10, 2010 at 06:04:48PM -0500, Leslie Rhorer wrote:
quoted
Hi, if I understood it correctly, in order to detect the several array parameters (number of disks, for example), it is possible to use "mdadm -D /dev/mdX" or to check the files in the corresponding /sys/block/... /mdX/... files.Yes, but only if the array is assembled. If not, it's "-E", not "-D", and the target is a member device, not the array.quoted
Now, assuming something needs to be done in scripts, what would be the best way? Using "mdadm -D ... | grep" (or "mdadm ... | gawk ...."), or to read the proper files in /sys/block/md...?That depends on what you need to do. If you need to obtain in depth information about the array and / or act only upon specific contents of a line in the output, then you need to use gawk. If your script merely takes action based upon the existence of some meta-content of the output, then grep or even grep -q may be the better choice.quoted
Assuming the wanted information is available on both sides, which does not seem always the case.I don't know what you mean by "both sides". -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
-- piergiorgio