4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
28 # Copyright (c) 2013 by Delphix. All rights reserved.
31 export DISKSARRAY=$DISKS
32 export DISK_ARRAY_NUM=$($ECHO ${DISKS} | $NAWK '{print NF}')
34 typeset -i NUMBER_OF_DISKS=0
36 [[ -n $MIRROR_PRIMARY ]] && MIRROR_SECONDARY=$i
37 [[ -z $MIRROR_PRIMARY ]] && MIRROR_PRIMARY=$i
40 if [[ -z $MIRROR_SECONDARY ]]; then
41 # We need to repartition the single disk to two slices
42 SINGLE_DISK=$MIRROR_PRIMARY
43 MIRROR_SECONDARY=$MIRROR_PRIMARY
47 if is_mpath_device $MIRROR_PRIMARY; then
48 export DEV_DSKDIR=$DEV_MPATHDIR
50 export DEV_DSKDIR=$DEV_RDSKDIR
52 if ( is_mpath_device $SINGLE_DISK ) && [[ -z $($ECHO $SINGLE_DISK | awk 'substr($1,18,1)\
53 ~ /^[[:digit:]]+$/') ]] || ( is_real_device $SINGLE_DISK ); then
54 SIDE_PRIMARY=${SINGLE_DISK}1
55 SIDE_SECONDARY=${SINGLE_DISK}2
56 elif ( is_mpath_device $SINGLE_DISK || is_loop_device $SINGLE_DISK ); then
57 SIDE_PRIMARY=${SINGLE_DISK}p1
58 SIDE_SECONDARY=${SINGLE_DISK}p2
60 log_fail "$SINGLE_DISK not supported for partitioning."
63 export DEV_DSKDIR="/dev"
64 SIDE_PRIMARY=${SINGLE_DISK}s${SIDE_PRIMARY_PART}
65 SIDE_SECONDARY=${SINGLE_DISK}s${SIDE_SECONDARY_PART}
71 if is_mpath_device $MIRROR_PRIMARY; then
72 export DEV_DSKDIR=$DEV_MPATHDIR
74 export DEV_DSKDIR=$DEV_RDSKDIR
76 if ( is_mpath_device $MIRROR_PRIMARY ) && [[ -z $($ECHO $MIRROR_PRIMARY | awk 'substr($1,18,1)\
77 ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_PRIMARY ); then
78 SIDE_PRIMARY=${MIRROR_PRIMARY}1
79 elif ( is_mpath_device $MIRROR_PRIMARY || is_loop_device $MIRROR_PRIMARY ); then
80 SIDE_PRIMARY=${MIRROR_PRIMARY}p1
82 log_fail "$MIRROR_PRIMARY not supported for partitioning."
84 if ( is_mpath_device $MIRROR_SECONDARY ) && [[ -z $($ECHO $MIRROR_SECONDARY | awk 'substr($1,18,1)\
85 ~ /^[[:digit:]]+$/') ]] || ( is_real_device $MIRROR_SECONDARY ); then
86 SIDE_SECONDARY=${MIRROR_SECONDARY}1
87 elif ( is_mpath_device $MIRROR_SECONDARY || is_loop_device $MIRROR_SECONDARY ); then
88 SIDE_SECONDARY=${MIRROR_SECONDARY}p1
90 log_fail "$MIRROR_SECONDARY not supported for partitioning."
93 export DEV_DSKDIR="/dev"
94 SIDE_PRIMARY=${MIRROR_PRIMARY}s${SIDE_PRIMARY_PART}
95 SIDE_SECONDARY=${MIRROR_SECONDARY}s${SIDE_SECONDARY_PART}
100 export MIRROR_PRIMARY MIRROR_SECONDARY SINGLE_DISK SIDE_PRIMARY SIDE_SECONDARY
103 export FILE_SIZE=$(( 1024 * 1024 ))
104 export MIRROR_MEGS=100
105 export MIRROR_SIZE=${MIRROR_MEGS}m # default mirror size
106 export DD_BLOCK=$(( 64 * 1024 ))
107 export DD_COUNT=$(( MIRROR_MEGS * 1024 * 1024 / DD_BLOCK ))