summaryrefslogtreecommitdiffstats
path: root/src/usr/local/sbin/cleargpt.sh
blob: 07d530a5b105aa0ed1154c1f91348aaa1067f17c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
DISK=$1
if [ "$DISK" = "" ]; then
	echo "You must specify the disk that should be formatted/cleared."
	exit 1
fi
for PART in `/sbin/gpart show $DISK | grep -v '=>' | awk '{ print $3 }'`; do
	if [ "$PART" != "" ]; then
		/sbin/gpart delete -i $PART $DISK >/dev/null
	fi
done
/sbin/gpart destroy $DISK >/dev/null
exit 0
OpenPOWER on IntegriCloud