Print this page
8891 One unmountable dataset on rpool breaks a lot of things


   4 #
   5 # The contents of this file are subject to the terms of the
   6 # Common Development and Distribution License (the "License").
   7 # You may not use this file except in compliance with the License.
   8 #
   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 #
  23 # Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.

  24 #
  25 
  26 . /lib/svc/share/smf_include.sh
  27 
  28 result=$SMF_EXIT_OK
  29 mntretry=0
  30 
  31 # Mount all local filesystems.
  32 
  33 cd /; /sbin/mountall -l >/var/run/fs-local 2>&1
  34 rc=$?
  35 if [ $rc -eq 111 ]; then
  36         #
  37         #  The only failures were lofs mounts, we can try again
  38         #  after zfs is mounted, there is a chance a lofs mount
  39         #  failed due to it depending on a zfs not yet mounted.
  40         #
  41         mntretry=1
  42 elif [ $rc -ne 0 ]; then
  43         cat /var/run/fs-local >/dev/msglog
  44         msg="WARNING: /sbin/mountall -l failed: exit status $rc"
  45         echo $msg
  46         echo "$SMF_FMRI:" $msg >/dev/msglog
  47         result=$SMF_EXIT_ERR_FATAL
  48 fi
  49 rm -f /var/run/fs-local
  50 
  51 #
  52 # If there are non-global UFS filesystems with quotas, check and enable them.
  53 #
  54 
  55 # vlist is the non-global filesystems in vfstab requesting quotas
  56 vlist=`/usr/bin/nawk '$1 !~ /^(#|-)/ && $4 == "ufs" {
  57         if (match($7, "(^|,)(quota|rq)(,|$)") != 0 &&
  58             match($7, "(^|,)global(,|$)") == 0) print $1; }' /etc/vfstab`
  59 
  60 if [ -n "$vlist" ]; then
  61         # mlist is the filesystems in mnttab that are ufs, mounted rw,
  62         # and without quotas turned on
  63         mlist=`/usr/sbin/mount -p | /usr/bin/nawk '$4 == "ufs" {
  64                 if (match($7, "(^|,)ro(,|$)") == 0) print $1; }'`
  65 
  66         # qlist is the intersection of vlist and mlist
  67         qlist=`echo "$vlist\n-\n$mlist" | \


  76         # the entries with the global option (the global entries are handled
  77         # later in another script if the cluster package is installed).
  78         #
  79         if [ -n "$qlist" ]; then
  80                 echo 'Checking UFS quotas: \c'
  81                 /usr/sbin/quotacheck -p $qlist
  82                 echo 'done.'
  83                 /usr/sbin/quotaon $qlist
  84         fi
  85 fi
  86 
  87 # Mount all ZFS filesystems.
  88 
  89 if [ -x /usr/sbin/zfs ]; then
  90         /usr/sbin/zfs mount -va >/dev/msglog 2>&1
  91         rc=$?
  92         if [ $rc -ne 0 ]; then
  93                 msg="WARNING: /usr/sbin/zfs mount -a failed: exit status $rc"
  94                 echo $msg
  95                 echo "$SMF_FMRI:" $msg >/dev/msglog
  96                 result=$SMF_EXIT_ERR_FATAL
  97         fi
  98 fi
  99 
 100 if [ $result = $SMF_EXIT_OK -a $mntretry -eq 1 ]
 101 then
 102         cd /; /sbin/mountall -l >/dev/msglog
 103         rc=$?
 104         if [ $rc -ne 0 ]; then
 105                 msg="WARNING: /sbin/mountall -l failed: exit status $rc"
 106                 echo $msg
 107                 echo "$SMF_FMRI:" $msg >/dev/msglog
 108                 result=$SMF_EXIT_ERR_FATAL
 109         fi
 110 fi
 111 
 112 # Add swap filesystems
 113 /sbin/swapadd >/dev/null 2>&1
 114 
 115 exit $result


   4 #
   5 # The contents of this file are subject to the terms of the
   6 # Common Development and Distribution License (the "License").
   7 # You may not use this file except in compliance with the License.
   8 #
   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 #
  23 # Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24 # Copyright 2017 RackTop Systems.
  25 #
  26 
  27 . /lib/svc/share/smf_include.sh
  28 
  29 result=$SMF_EXIT_OK
  30 mntretry=0
  31 
  32 # Mount all local filesystems.
  33 
  34 cd /; /sbin/mountall -l >/var/run/fs-local 2>&1
  35 rc=$?
  36 if [ $rc -eq 111 ]; then
  37         #
  38         #  The only failures were lofs mounts, we can try again
  39         #  after zfs is mounted, there is a chance a lofs mount
  40         #  failed due to it depending on a zfs not yet mounted.
  41         #
  42         mntretry=1
  43 elif [ $rc -ne 0 ]; then
  44         cat /var/run/fs-local >/dev/msglog
  45         msg="WARNING: /sbin/mountall -l failed: exit status $rc"
  46         echo $msg
  47         echo "$SMF_FMRI:" $msg >/dev/msglog
  48         result=$SMF_EXIT_MON_DEGRADE
  49 fi
  50 rm -f /var/run/fs-local
  51 
  52 #
  53 # If there are non-global UFS filesystems with quotas, check and enable them.
  54 #
  55 
  56 # vlist is the non-global filesystems in vfstab requesting quotas
  57 vlist=`/usr/bin/nawk '$1 !~ /^(#|-)/ && $4 == "ufs" {
  58         if (match($7, "(^|,)(quota|rq)(,|$)") != 0 &&
  59             match($7, "(^|,)global(,|$)") == 0) print $1; }' /etc/vfstab`
  60 
  61 if [ -n "$vlist" ]; then
  62         # mlist is the filesystems in mnttab that are ufs, mounted rw,
  63         # and without quotas turned on
  64         mlist=`/usr/sbin/mount -p | /usr/bin/nawk '$4 == "ufs" {
  65                 if (match($7, "(^|,)ro(,|$)") == 0) print $1; }'`
  66 
  67         # qlist is the intersection of vlist and mlist
  68         qlist=`echo "$vlist\n-\n$mlist" | \


  77         # the entries with the global option (the global entries are handled
  78         # later in another script if the cluster package is installed).
  79         #
  80         if [ -n "$qlist" ]; then
  81                 echo 'Checking UFS quotas: \c'
  82                 /usr/sbin/quotacheck -p $qlist
  83                 echo 'done.'
  84                 /usr/sbin/quotaon $qlist
  85         fi
  86 fi
  87 
  88 # Mount all ZFS filesystems.
  89 
  90 if [ -x /usr/sbin/zfs ]; then
  91         /usr/sbin/zfs mount -va >/dev/msglog 2>&1
  92         rc=$?
  93         if [ $rc -ne 0 ]; then
  94                 msg="WARNING: /usr/sbin/zfs mount -a failed: exit status $rc"
  95                 echo $msg
  96                 echo "$SMF_FMRI:" $msg >/dev/msglog
  97                 result=$SMF_EXIT_MON_DEGRADE
  98         fi
  99 fi
 100 
 101 if [ $result = $SMF_EXIT_OK -a $mntretry -eq 1 ]
 102 then
 103         cd /; /sbin/mountall -l >/dev/msglog
 104         rc=$?
 105         if [ $rc -ne 0 ]; then
 106                 msg="WARNING: /sbin/mountall -l failed: exit status $rc"
 107                 echo $msg
 108                 echo "$SMF_FMRI:" $msg >/dev/msglog
 109                 result=$SMF_EXIT_MON_DEGRADE
 110         fi
 111 fi
 112 
 113 # Add swap filesystems
 114 /sbin/swapadd >/dev/null 2>&1
 115 
 116 exit $result