summaryrefslogtreecommitdiffstats
path: root/usr/local/sbin/cleargpt.sh
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-07-27 17:05:05 -0300
committerRenato Botelho <renato@netgate.com>2015-07-27 17:05:05 -0300
commit31e66b412d52cf40aa5a8cb4e050c9f176cdf4e0 (patch)
treec8322c322005b7aab9310909815311aec1f19a21 /usr/local/sbin/cleargpt.sh
parentf8948f8637756d55642b9adabe9e8d7923ac98ff (diff)
downloadpfsense-31e66b412d52cf40aa5a8cb4e050c9f176cdf4e0.zip
pfsense-31e66b412d52cf40aa5a8cb4e050c9f176cdf4e0.tar.gz
Move cleargpt.sh and cleargmirror.sh scripts to main repo
Diffstat (limited to 'usr/local/sbin/cleargpt.sh')
-rwxr-xr-xusr/local/sbin/cleargpt.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/usr/local/sbin/cleargpt.sh b/usr/local/sbin/cleargpt.sh
new file mode 100755
index 0000000..07d530a
--- /dev/null
+++ b/usr/local/sbin/cleargpt.sh
@@ -0,0 +1,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