Solved

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

Posted on 2010-11-23
4
654 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:dlethe
[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:
dlethe 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:dlethe
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:dlethe
ID: 37023119
couldn't find any other way to do it.  Not ideal, but zdb won't hang under degraded configurations.
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…

732 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