Jan Owoc
2012-Oct-04 15:58 UTC
[zfs-discuss] removing upgrade notice from ''zpool status -x''
Hi, I have a machine whose zpools are at version 28, and I would like to keep them at that version for portability between OSes. I understand that ''zpool status'' asks me to upgrade, but so does ''zpool status -x'' (the man page says it should only report errors or unavailability). This is a problem because I have a script that assumes "zpool status -x" only returns errors requiring user intervention. Is there a way to either: A) suppress the upgrade notice from ''zpool status -x'' ? B) use a different command to get information about actual errors w/out encountering the upgrade notice ? I''m using OpenIndiana 151a6 on x86. Jan
Richard Elling
2012-Oct-04 16:14 UTC
[zfs-discuss] removing upgrade notice from ''zpool status -x''
On Oct 4, 2012, at 8:58 AM, Jan Owoc <jsowoc at gmail.com> wrote:> Hi, > > I have a machine whose zpools are at version 28, and I would like to > keep them at that version for portability between OSes. I understand > that ''zpool status'' asks me to upgrade, but so does ''zpool status -x'' > (the man page says it should only report errors or unavailability). > This is a problem because I have a script that assumes "zpool status > -x" only returns errors requiring user intervention.The return code for zpool is ambiguous. Do not rely upon it to determine if the pool is healthy. You should check the health property instead.> Is there a way to either: > A) suppress the upgrade notice from ''zpool status -x'' ?Pedantic answer, it is open source ;-)> B) use a different command to get information about actual errors > w/out encountering the upgrade notice ? > > I''m using OpenIndiana 151a6 on x86.-- richard -- Richard.Elling at RichardElling.com +1-760-896-4422 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20121004/70371d21/attachment.html>
Freddie Cash
2012-Oct-04 16:36 UTC
[zfs-discuss] removing upgrade notice from ''zpool status -x''
On Thu, Oct 4, 2012 at 9:14 AM, Richard Elling <richard.elling at gmail.com> wrote:> On Oct 4, 2012, at 8:58 AM, Jan Owoc <jsowoc at gmail.com> wrote: > The return code for zpool is ambiguous. Do not rely upon it to determine > if the pool is healthy. You should check the health property instead.Huh. Learn something new everyday. You just simplified my "pool health check" script immensely. Thank you! pstatus=$( zpool get health storage | grep "health" | awk ''{ print $3 }'' ) if [ "${pstatus}" != "ONLINE" ]; then Much simpler than the nested ifs and grep pipelines I was using before. Not sure why I didn''t see "health" in the list of pool properties all the times I''ve read the zpool man page. -- Freddie Cash fjwcash at gmail.com
Jim Klimov
2012-Oct-04 16:45 UTC
[zfs-discuss] removing upgrade notice from ''zpool status -x''
2012-10-04 20:36, Freddie Cash ?????:> On Thu, Oct 4, 2012 at 9:14 AM, Richard Elling <richard.elling at gmail.com> wrote: >> On Oct 4, 2012, at 8:58 AM, Jan Owoc <jsowoc at gmail.com> wrote: >> The return code for zpool is ambiguous. Do not rely upon it to determine >> if the pool is healthy. You should check the health property instead. > > Huh. Learn something new everyday. You just simplified my "pool > health check" script immensely. Thank you! > > pstatus=$( zpool get health storage | grep "health" | awk ''{ print $3 }'' ) > if [ "${pstatus}" != "ONLINE" ]; thenSimplify that too with "zpool list": # zpool list -H -o health rpool ONLINE ;) //Jim
Freddie Cash
2012-Oct-04 16:47 UTC
[zfs-discuss] removing upgrade notice from ''zpool status -x''
On Thu, Oct 4, 2012 at 9:45 AM, Jim Klimov <jimklimov at cos.ru> wrote:> 2012-10-04 20:36, Freddie Cash ?????: >> >> On Thu, Oct 4, 2012 at 9:14 AM, Richard Elling <richard.elling at gmail.com> >> wrote: >>> >>> On Oct 4, 2012, at 8:58 AM, Jan Owoc <jsowoc at gmail.com> wrote: >>> The return code for zpool is ambiguous. Do not rely upon it to determine >>> if the pool is healthy. You should check the health property instead. >> >> >> Huh. Learn something new everyday. You just simplified my "pool >> health check" script immensely. Thank you! >> >> pstatus=$( zpool get health storage | grep "health" | awk ''{ print $3 }'' ) >> if [ "${pstatus}" != "ONLINE" ]; then > > > Simplify that too with "zpool list": > > # zpool list -H -o health rpool > ONLINEThanks! Was trying to figure out how to remove the heading as I use -H a lot with zfs commands, but it didn''t work for "zpool get" and I didn''t bother reading to figure it out. :) -- Freddie Cash fjwcash at gmail.com