10Sstevel@tonic-gate#!/sbin/sh 20Sstevel@tonic-gate# 30Sstevel@tonic-gate# CDDL HEADER START 40Sstevel@tonic-gate# 50Sstevel@tonic-gate# The contents of this file are subject to the terms of the 62334Ssetje# Common Development and Distribution License (the "License"). 72334Ssetje# You may not use this file except in compliance with the License. 80Sstevel@tonic-gate# 90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate# See the License for the specific language governing permissions 120Sstevel@tonic-gate# and limitations under the License. 130Sstevel@tonic-gate# 140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate# 200Sstevel@tonic-gate# CDDL HEADER END 210Sstevel@tonic-gate# 220Sstevel@tonic-gate# 23*12250SGowtham.Thommandra@Sun.COM# Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. 240Sstevel@tonic-gate# 250Sstevel@tonic-gate 260Sstevel@tonic-gate. /lib/svc/share/smf_include.sh 270Sstevel@tonic-gate 28789Sahrensresult=$SMF_EXIT_OK 298155STim.Haley@Sun.COMmntretry=0 30789Sahrens 310Sstevel@tonic-gate# Mount all local filesystems. 320Sstevel@tonic-gate 338155STim.Haley@Sun.COMcd /; /sbin/mountall -l >/var/run/fs-local 2>&1 340Sstevel@tonic-gaterc=$? 358155STim.Haley@Sun.COMif [ $rc -eq 111 ]; then 368155STim.Haley@Sun.COM # 378155STim.Haley@Sun.COM # The only failures were lofs mounts, we can try again 388155STim.Haley@Sun.COM # after zfs is mounted, there is a chance a lofs mount 398155STim.Haley@Sun.COM # failed due to it depending on a zfs not yet mounted. 408155STim.Haley@Sun.COM # 418155STim.Haley@Sun.COM mntretry=1 428155STim.Haley@Sun.COMelif [ $rc -ne 0 ]; then 438155STim.Haley@Sun.COM cat /var/run/fs-local >/dev/msglog 440Sstevel@tonic-gate msg="WARNING: /sbin/mountall -l failed: exit status $rc" 450Sstevel@tonic-gate echo $msg 460Sstevel@tonic-gate echo "$SMF_FMRI:" $msg >/dev/msglog 47789Sahrens result=$SMF_EXIT_ERR_FATAL 480Sstevel@tonic-gatefi 498155STim.Haley@Sun.COMrm -f /var/run/fs-local 500Sstevel@tonic-gate 510Sstevel@tonic-gate# 520Sstevel@tonic-gate# If there are non-global UFS filesystems with quotas, check and enable them. 530Sstevel@tonic-gate# 540Sstevel@tonic-gate 550Sstevel@tonic-gate# vlist is the non-global filesystems in vfstab requesting quotas 560Sstevel@tonic-gatevlist=`/usr/bin/nawk '$1 !~ /^(#|-)/ && $4 == "ufs" { 570Sstevel@tonic-gate if (match($7, "(^|,)(quota|rq)(,|$)") != 0 && 580Sstevel@tonic-gate match($7, "(^|,)global(,|$)") == 0) print $1; }' /etc/vfstab` 590Sstevel@tonic-gate 600Sstevel@tonic-gateif [ -n "$vlist" ]; then 610Sstevel@tonic-gate # mlist is the filesystems in mnttab that are ufs, mounted rw, 620Sstevel@tonic-gate # and without quotas turned on 630Sstevel@tonic-gate mlist=`/usr/sbin/mount -p | /usr/bin/nawk '$4 == "ufs" { 640Sstevel@tonic-gate if (match($7, "(^|,)ro(,|$)") == 0) print $1; }'` 650Sstevel@tonic-gate 660Sstevel@tonic-gate # qlist is the intersection of vlist and mlist 670Sstevel@tonic-gate qlist=`echo "$vlist\n-\n$mlist" | \ 680Sstevel@tonic-gate /usr/bin/nawk '{if ($1 == "-") { mlist = 1; } 690Sstevel@tonic-gate else if (mlist == 0) { vlist[$1] = 1; } 700Sstevel@tonic-gate else if (vlist[$1]) { print $1; } }'` 710Sstevel@tonic-gate 720Sstevel@tonic-gate # 730Sstevel@tonic-gate # Just check and enable the non-global UFS file systems with quotas 740Sstevel@tonic-gate # enabled. Note that "quotacheck -a" and "quotaon -a" will try 750Sstevel@tonic-gate # to process all UFS entries with quotas rather than excluding 760Sstevel@tonic-gate # the entries with the global option (the global entries are handled 770Sstevel@tonic-gate # later in another script if the cluster package is installed). 780Sstevel@tonic-gate # 790Sstevel@tonic-gate if [ -n "$qlist" ]; then 800Sstevel@tonic-gate echo 'Checking UFS quotas: \c' 810Sstevel@tonic-gate /usr/sbin/quotacheck -p $qlist 820Sstevel@tonic-gate echo 'done.' 830Sstevel@tonic-gate /usr/sbin/quotaon $qlist 840Sstevel@tonic-gate fi 850Sstevel@tonic-gatefi 860Sstevel@tonic-gate 87789Sahrens# Mount all ZFS filesystems. 88789Sahrens 89789Sahrensif [ -x /usr/sbin/zfs ]; then 904737Smmusante /usr/sbin/zfs mount -va >/dev/msglog 2>&1 91789Sahrens rc=$? 92789Sahrens if [ $rc -ne 0 ]; then 93789Sahrens msg="WARNING: /usr/sbin/zfs mount -a failed: exit status $rc" 94789Sahrens echo $msg 95789Sahrens echo "$SMF_FMRI:" $msg >/dev/msglog 96789Sahrens result=$SMF_EXIT_ERR_FATAL 97789Sahrens fi 98789Sahrensfi 99789Sahrens 1008155STim.Haley@Sun.COMif [ $result = $SMF_EXIT_OK -a $mntretry -eq 1 ] 1018155STim.Haley@Sun.COMthen 1028155STim.Haley@Sun.COM cd /; /sbin/mountall -l >/dev/msglog 1038155STim.Haley@Sun.COM rc=$? 1048155STim.Haley@Sun.COM if [ $rc -ne 0 ]; then 1058155STim.Haley@Sun.COM msg="WARNING: /sbin/mountall -l failed: exit status $rc" 1068155STim.Haley@Sun.COM echo $msg 1078155STim.Haley@Sun.COM echo "$SMF_FMRI:" $msg >/dev/msglog 1088155STim.Haley@Sun.COM result=$SMF_EXIT_ERR_FATAL 1098155STim.Haley@Sun.COM fi 1108155STim.Haley@Sun.COMfi 1118155STim.Haley@Sun.COM 112*12250SGowtham.Thommandra@Sun.COM# Add swap filesystems 113*12250SGowtham.Thommandra@Sun.COM/sbin/swapadd >/dev/null 2>&1 114*12250SGowtham.Thommandra@Sun.COM 115789Sahrensexit $result 116