?
Solved

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

Posted on 2010-11-23
4
Medium Priority
?
659 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

764 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