Solved

how to query if zpool is online (to get around a bug where zfs commands hang)

Posted on 2010-11-23
4
657 Views
Last Modified: 2013-12-27
I want to simply see if a zpool is online in a script, but need to do it in such a way that gets around a known bug.  Specifically, if I have a pool that is offline, then any call to zfs status, zpool, or zfs commands lock up and create a process which I can not terminate).

I can issue a zdb -c poolname and this enumerates the configuration of the pool, but it does not provide any information whether or not it is online.    

So is there a way to see if a pool is online that doesn't require the zfs or zpool command?  (Or uses the zdb command to enumerate something)?

Note that it is possible that a pool won't have any mounted file systems attached to it, but still perhaps there is a creative way I can use dd or something like that to attempt to read from a raw pool device driver?
0
Comment
Question by:David
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 47

Accepted Solution

by:
David earned 0 total points
ID: 34201509
Found something ...
zdb -uuu poolname  will return I/O error message if pool is offline.  If any expert has a better solution that will run more quickly (I don't mind calling something from C), then I'll be happy to award points.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 37002868
zpool status poolname

  pool: poolname
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        poolname  ONLINE     0     0     0
           mirror-0  ONLINE       0     0     0
            c0t1d0  ONLINE       0     0     0
            c1t1d0  ONLINE       0     0     0

errors: No known data errors
0
 
LVL 47

Author Comment

by:David
ID: 37002923
zpool status can & will hang if a disk goes offline or there is a path failure.  (Mentioned in the original question).  Using zdb is the only way to get around it.  Sorry, I forgot to close the question.
0
 
LVL 47

Author Closing Comment

by:David
ID: 37023119
couldn't find any other way to do it.  Not ideal, but zdb won't hang under degraded configurations.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question