Module Name: othersrc
Committed By: agc
Date: Wed May 18 01:37:58 UTC 2011
Modified Files:
othersrc/external/bsd/genraidconf: genraidconf.sh
Log Message:
work out the partition letter of the first partition properly
invoke fdisk properly
use the correct partition letter in the raidN.conf file
invoke ci with a default description of the file as well as a commit message.
with these changes, we properly configure and initialise a raid1 set on 2 vnd
devices.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/genraidconf/genraidconf.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/external/bsd/genraidconf/genraidconf.sh
diff -u othersrc/external/bsd/genraidconf/genraidconf.sh:1.1.1.1 othersrc/external/bsd/genraidconf/genraidconf.sh:1.2
--- othersrc/external/bsd/genraidconf/genraidconf.sh:1.1.1.1 Tue May 17 03:48:50 2011
+++ othersrc/external/bsd/genraidconf/genraidconf.sh Wed May 18 01:37:58 2011
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: genraidconf.sh,v 1.1.1.1 2011/05/17 03:48:50 agc Exp $
+# $NetBSD: genraidconf.sh,v 1.2 2011/05/18 01:37:58 agc Exp $
# Copyright (c) 2011 Alistair Crooks <[email protected]>
# All rights reserved.
@@ -80,14 +80,16 @@
# work out whether we use a dos disk lebel
case $(sysctl kern.rawpartition) in
-2) wholedisk=c
+*2) wholedisk=c
firstpart=d
doslabel=false
;;
-3) wholedisk=d
+*3) wholedisk=d
firstpart=e
doslabel=true
;;
+*) die "can't find raw partition number"
+ ;;
esac
# count number of devices
@@ -104,7 +106,11 @@
sectorc=0
devs=""
while [ $# -gt ${lastdev} ]; do
- devs="${devs}|/dev/$1${firstpart}"
+ case "$1" in
+ vnd*) part1=a ;;
+ *) part1=${firstpart} ;;
+ esac
+ devs="${devs}|/dev/$1${part1}"
nsectorc=$(disklabel $1 2>/dev/null | awk '/^total sectors:/ {print $3;exit}')
case "${nsectorc}" in
"") die "device $1 not found on computer" ;;
@@ -148,7 +154,8 @@
# put an fdisk label on there
if ${doslabel}; then
for d in ${disks}; do
- ${doit} fdisk -uai -A 2048 ${d}a
+ secs=$(expr ${sectorc} - 2048)
+ ${doit} fdisk -u -a -i -f -3 -s 169/2048/${secs} -b 100/1/${sectorc} -A 2048/2048 ${d}a
done
fi
@@ -185,7 +192,7 @@
if [ -e /etc/${raiddev}.conf ]; then
echo "Preserving previous ${raiddev}.conf in /etc/RCS"
${doit} mkdir -p /etc/RCS
- (cd /etc && ${doit} ci -l -m"creating new ${raiddev}.conf" ${raiddev}.conf)
+ (cd /etc && ${doit} ci -l -m"creating new ${raiddev}.conf" -t-"new ${raiddev}.conf file" ${raiddev}.conf)
fi
# set up spare definitions if we need one
@@ -195,8 +202,12 @@
spare2=""
;;
1)
+ case "$1" in
+ vnd*) part1=a ;;
+ *) part1=${firstpart} ;;
+ esac
spare1="START spare"
- spare2="/dev/${1}${firstpart}"
+ spare2="/dev/${1}${part1}"
;;
esac
case "${doit}" in