17c478bd9Sstevel@tonic-gate#!/sbin/sh 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 658091fd8Ssetje# Common Development and Distribution License (the "License"). 758091fd8Ssetje# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 227c478bd9Sstevel@tonic-gate# 23*dae68f5eSmmusante# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate#ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh 297c478bd9Sstevel@tonic-gate 30fa9e4066Sahrensresult=$SMF_EXIT_OK 31fa9e4066Sahrens 327c478bd9Sstevel@tonic-gate# Mount all local filesystems. 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gatecd /; /sbin/mountall -l >/dev/msglog 357c478bd9Sstevel@tonic-gaterc=$? 367c478bd9Sstevel@tonic-gateif [ $rc -ne 0 ]; then 377c478bd9Sstevel@tonic-gate msg="WARNING: /sbin/mountall -l failed: exit status $rc" 387c478bd9Sstevel@tonic-gate echo $msg 397c478bd9Sstevel@tonic-gate echo "$SMF_FMRI:" $msg >/dev/msglog 40fa9e4066Sahrens result=$SMF_EXIT_ERR_FATAL 417c478bd9Sstevel@tonic-gatefi 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate# 447c478bd9Sstevel@tonic-gate# If there are non-global UFS filesystems with quotas, check and enable them. 457c478bd9Sstevel@tonic-gate# 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate# vlist is the non-global filesystems in vfstab requesting quotas 487c478bd9Sstevel@tonic-gatevlist=`/usr/bin/nawk '$1 !~ /^(#|-)/ && $4 == "ufs" { 497c478bd9Sstevel@tonic-gate if (match($7, "(^|,)(quota|rq)(,|$)") != 0 && 507c478bd9Sstevel@tonic-gate match($7, "(^|,)global(,|$)") == 0) print $1; }' /etc/vfstab` 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gateif [ -n "$vlist" ]; then 537c478bd9Sstevel@tonic-gate # mlist is the filesystems in mnttab that are ufs, mounted rw, 547c478bd9Sstevel@tonic-gate # and without quotas turned on 557c478bd9Sstevel@tonic-gate mlist=`/usr/sbin/mount -p | /usr/bin/nawk '$4 == "ufs" { 567c478bd9Sstevel@tonic-gate if (match($7, "(^|,)ro(,|$)") == 0) print $1; }'` 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate # qlist is the intersection of vlist and mlist 597c478bd9Sstevel@tonic-gate qlist=`echo "$vlist\n-\n$mlist" | \ 607c478bd9Sstevel@tonic-gate /usr/bin/nawk '{if ($1 == "-") { mlist = 1; } 617c478bd9Sstevel@tonic-gate else if (mlist == 0) { vlist[$1] = 1; } 627c478bd9Sstevel@tonic-gate else if (vlist[$1]) { print $1; } }'` 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate # 657c478bd9Sstevel@tonic-gate # Just check and enable the non-global UFS file systems with quotas 667c478bd9Sstevel@tonic-gate # enabled. Note that "quotacheck -a" and "quotaon -a" will try 677c478bd9Sstevel@tonic-gate # to process all UFS entries with quotas rather than excluding 687c478bd9Sstevel@tonic-gate # the entries with the global option (the global entries are handled 697c478bd9Sstevel@tonic-gate # later in another script if the cluster package is installed). 707c478bd9Sstevel@tonic-gate # 717c478bd9Sstevel@tonic-gate if [ -n "$qlist" ]; then 727c478bd9Sstevel@tonic-gate echo 'Checking UFS quotas: \c' 737c478bd9Sstevel@tonic-gate /usr/sbin/quotacheck -p $qlist 747c478bd9Sstevel@tonic-gate echo 'done.' 757c478bd9Sstevel@tonic-gate /usr/sbin/quotaon $qlist 767c478bd9Sstevel@tonic-gate fi 777c478bd9Sstevel@tonic-gatefi 787c478bd9Sstevel@tonic-gate 79fa9e4066Sahrens# Mount all ZFS filesystems. 80fa9e4066Sahrens 81fa9e4066Sahrensif [ -x /usr/sbin/zfs ]; then 82*dae68f5eSmmusante /usr/sbin/zfs mount -va >/dev/msglog 2>&1 83fa9e4066Sahrens rc=$? 84fa9e4066Sahrens if [ $rc -ne 0 ]; then 85fa9e4066Sahrens msg="WARNING: /usr/sbin/zfs mount -a failed: exit status $rc" 86fa9e4066Sahrens echo $msg 87fa9e4066Sahrens echo "$SMF_FMRI:" $msg >/dev/msglog 88fa9e4066Sahrens result=$SMF_EXIT_ERR_FATAL 89fa9e4066Sahrens fi 90fa9e4066Sahrensfi 91fa9e4066Sahrens 92fa9e4066Sahrensexit $result 93