blob: a00cc93a6d6822def1cb73ae57a16f83f205f7ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/bin/sh
clear_disk() {
local _disk="${1}"
local _mirror=$(/sbin/gmirror dump ${_disk} 2>/dev/null | sed '/name: /!d; s,^.*: ,,')
if [ -n "${_mirror}" ]; then
/sbin/gmirror destroy -f ${_mirror} >/dev/null 2>&1
fi
/sbin/gmirror clear ${_disk} >/dev/null 2>&1
}
mirror="${1}"
disk1="${2}"
disk2="${3}"
if [ -z "${mirror}" -o -z "${disk1}" -o -z "${disk2}" ]; then
echo "You must specify mirror name, and disks that should be cleared"
exit 1
fi
/sbin/gmirror destroy -f ${mirror} >/dev/null 2>&1
clear_disk ${disk1}
clear_disk ${disk2}
exit 0
|