14 lines
322 B
Bash
14 lines
322 B
Bash
#!/bin/sh
|
|
DISK=$1
|
|
if [ "$DISK" = "" ]; then
|
|
echo "You must specify the disk that should be formatted/cleared."
|
|
exit 1
|
|
fi
|
|
for PART in `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
|