All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wakko Warner <wakko@animx.eu.org>
To: Jose Manuel dos Santos Calhariz <jose.spam@netvisao.pt>
Cc: linux-raid@vger.kernel.org
Subject: Re: Script to save array info
Date: Thu, 21 Jun 2012 17:37:00 -0400	[thread overview]
Message-ID: <20120621213700.GC10443@animx.eu.org> (raw)
In-Reply-To: <20120621142613.GA28130@calhariz.com>

Jose Manuel dos Santos Calhariz wrote:
> On Wed, Jun 20, 2012 at 07:21:49PM -0400, Wakko Warner wrote:
> > After reading some of the stories about lost metadata, I was wondering if
> > anyone had a script that would output the member info for each device with
> > the device's physical serial number.
> > 
> > For a crude one I did this while in /sys/block:
> > for x in sd*;do
> > 	echo /dev/$x
> > 	/lib/udev/scsi_id --export --page=0x80 --whitelisted /dev/$x
> > 	mdadm -E /dev/$x
> > done
> > 
> > And saved the output.  It works for me because all but 3 of my raid members
> > are full disks.
> 
> I made a script for myself, that collects the information by
> inspecting /sys instead of doing mdadm -E.  The script see all mdraid
> devices and all devices that belong to a mdraid.  I would like to know
> if the script works or not.  It works for me.

I've looked into /sys/block/md*/md before.  I've noticed there is
information not present in the output.

I just checked.  About the only thing important to me would be the "name"
that mdadm -E lists.  I don't know how important UUIDs would be but it could
be.

Looks like your script does essentially this one liner:
find /sys/block/md*/md -type f | xargs grep .

I didn't run it though.  I think yours added the ls -l of the rdX/block/
link.
I looked through everything in the block for some of my devices and none had
the serial number.  I had to use scsi_id from udev to get it.

One thing you might want to do to yours is "exec >> ${FILEMD}" instead of all
the >> ${FILEMD} that you had in your file.

-- 
 Microsoft has beaten Volkswagen's world record.  Volkswagen only created 22
 million bugs.

  reply	other threads:[~2012-06-21 21:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 23:21 Script to save array info Wakko Warner
2012-06-21  7:20 ` Phil Turmel
2012-06-21 14:26 ` Jose Manuel dos Santos Calhariz
2012-06-21 21:37   ` Wakko Warner [this message]
2012-06-22 11:50     ` Jose Manuel dos Santos Calhariz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120621213700.GC10443@animx.eu.org \
    --to=wakko@animx.eu.org \
    --cc=jose.spam@netvisao.pt \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.