5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
25 # Copyright 2003 Sun Microsystems, Inc. All rights reserved.
26 # Use is subject to license terms.
32 USAGE
="usage: $myname [ -M mount-point ] [ newfs-options ] raw-special-device"
33 if [ ! "$UFS_MKFS" ]; then
34 UFS_MKFS
="/usr/lib/fs/ufs/mkfs"
42 UFS_MKFS_NOTENOUGHSPACE
=33
45 mkfs_opts
="$mkfs_opts $1"
49 if [ ! "$mkfs_subopts" ]; then
52 mkfs_subopts
="$mkfs_subopts,$1"
56 while getopts "GM:Nva:b:c:d:f:i:m:n:o:r:s:t:C:" c
; do
61 M
) add_opt
"-M $OPTARG"; mount_pt
="$OPTARG" ;;
64 a
) add_subopt
"apc=$OPTARG" ;;
65 b
) add_subopt
"bsize=$OPTARG" ;;
66 c
) add_subopt
"cgsize=$OPTARG" ;;
67 d
) add_subopt
"gap=$OPTARG" ;;
68 f
) add_subopt
"fragsize=$OPTARG" ;;
69 i
) add_subopt
"nbpi=$OPTARG" ;;
70 m
) add_subopt
"free=$OPTARG" ;;
71 n
) add_subopt
"nrpos=$OPTARG" ;;
72 o
) add_subopt
"opt=$OPTARG" ;;
73 r
) add_subopt
"rps=`expr $OPTARG / 60`" ;;
75 t
) add_subopt
"ntrack=$OPTARG" ;;
76 C
) add_subopt
"maxcontig=$OPTARG" ;;
77 \?) echo $USAGE; exit 1 ;;
83 shift `expr $OPTIND - 1`
90 if [ ! "$size" ]; then
91 size
=`devinfo -p $raw_special | awk '{ print $5 }'`
92 if [ $?
-ne 0 -o ! "$size" ]; then
93 echo "$myname: cannot get partition size"
98 cmd
="$UFS_MKFS $mkfs_opts $mkfs_subopts $raw_special $size"
99 if [ -n "$verbose" ]; then
104 if [ $retv -eq $UFS_MKFS_NOTENOUGHSPACE ]; then
105 echo "Growing filesystem in increments due to limited available space."
107 while [ "$newsize" -lt "$size" ]; do
108 cmd
="$UFS_MKFS $mkfs_opts $mkfs_subopts -P $raw_special $size"
109 if [ -n "$verbose" ]; then
112 newsize
=`$cmd`; retv
=$?
113 if [ 0 -ne $retv -o -z "$newsize" ]; then
114 echo "$myname: cannot probe the possible file system size"
117 if [ 0 -eq "$newsize" ]; then
118 echo "$myname: the file system is full and cannot be grown, please delete some files"
122 cmd
="$UFS_MKFS $mkfs_opts $mkfs_subopts $raw_special $newsize"; retv
=$?
123 if [ -n "$verbose" ]; then
127 if [ 0 -ne $retv ]; then
128 echo "$myname: cannot grow file system to $newsize sectors"
133 "\nThe incremental grow has successfully completed, but since the first growth \
134 attempt failed (see output from first mkfs(1M) run), the filesystem is still \
135 locked and needs to be checked with fsck(1M).\n\
136 Please run \`fsck -F ufs $raw_special' and then unlock the filesystem \
137 with \`lockfs -u $mount_pt'." |
fmt;