[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensolaris-lvm-discuss
Subject:    Re: [lvm-discuss] Listing of available disk devices
From:       "Paul Kraus" <pk1048 () gmail ! com>
Date:       2006-08-02 12:58:15
Message-ID: ddea9cf0608020558q50cb3e59ya9290b572049f64c () mail ! gmail ! com
[Download RAW message or body]

On 7/27/06, Tom Whitten <thomas.whitten@sun.com> wrote:
> Sanjay Nadkarni writes:
> > Paul Kraus wrote:
> >
> > > I am looking for a programatic way to determine which disk devices are
> > > currently used and which are unused by any metadevices or metasets.

> > > Unfortunately, metaset only provides device names for devices
> > > currently owned by the host. The presence of other metasets and their
> > > owners is indicated, but not which devices they they contain.

> > The best way to do this is via libdiskmgt.  It covers not only the
> > devices used by SVM but also all other possible combinations like, ZFS,
> > swap and dump devices.

> Are you sure that libdiskmgt will discover disks that are part of an
> untaken set?  This seems to me to ge the crux of Paul's question.

OK, I have come up with an empirical method to do this that is just
plain ugly, but seems to work under Solaris 10.

I use the metastat and metaset output to eliminate disks that are in
use by metadevices and local metasets, then I run a 'format -f foo -s
-d ${disk I am testing} >/format.out 2>/format.out' where foo just
contains 'verify <cr> quit' ... If the output from format is nothing,
then the disk can be used, if the disk is in use by a metaset on a
remote host you get "Current Disk Type is not set." since the disk in
inaccessible due to the SCSI reservation of the host that owns the
metaset.

All disks in our environment are under SLVM control, so a disk that is
just used raw is not a case I need to cover.

I know this is not part of the documented API of format, and will
likely change with time, but it got a me a fix for now.

-- 
Paul Kraus
_______________________________________________
lvm-discuss mailing list
lvm-discuss@opensolaris.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic