summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pc-sysinstall
diff options
context:
space:
mode:
authorjpaetzel <jpaetzel@FreeBSD.org>2011-05-18 20:38:28 +0000
committerjpaetzel <jpaetzel@FreeBSD.org>2011-05-18 20:38:28 +0000
commitc284bd0acca4fe2b124844c65d42fe0bfb8f2656 (patch)
tree6dbabd2aff7bff601c0e3f36ba6eddd96a2f1509 /usr.sbin/pc-sysinstall
parent305a27a26c0cc376b8e2089f7a273cceed83cb89 (diff)
downloadFreeBSD-src-c284bd0acca4fe2b124844c65d42fe0bfb8f2656.zip
FreeBSD-src-c284bd0acca4fe2b124844c65d42fe0bfb8f2656.tar.gz
Wipeout the end of disks, home to things like gmirror metadata, backup GPT tables,
and other potential evil. Submitted by: Kris Moore <kris@pcbsd.org> Approved by: kib (mentor) Sponsored by: iXsystems
Diffstat (limited to 'usr.sbin/pc-sysinstall')
-rwxr-xr-xusr.sbin/pc-sysinstall/backend/functions-disk.sh12
1 files changed, 2 insertions, 10 deletions
diff --git a/usr.sbin/pc-sysinstall/backend/functions-disk.sh b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
index 94fb436..c63f7af 100755
--- a/usr.sbin/pc-sysinstall/backend/functions-disk.sh
+++ b/usr.sbin/pc-sysinstall/backend/functions-disk.sh
@@ -582,17 +582,9 @@ stop_gjournal()
# Function to wipe the potential backup gpt table from a disk
clear_backup_gpt_table()
{
- # Get the disk block size
- local dSize="`gpart show $1 | grep $1 | tr -s ' ' | cut -d ' ' -f 3`"
-
- # Make sure this is a valid number
- is_num "${dSize}" >/dev/null 2>/dev/null
- [ $? -ne 0 ] && return
-
- # Die backup label, DIE
echo_log "Clearing gpt backup table location on disk"
- rc_nohalt "dd if=/dev/zero of=${1} bs=512 seek=${dSize}"
-
+ rc_nohalt "dd if=/dev/zero of=${1} bs=1m count=1"
+ rc_nohalt "dd if=/dev/zero of=${1} bs=1m oseek=`diskinfo ${1} | awk '{print int($3 / (1024*1024)) - 4;}'`"
} ;
OpenPOWER on IntegriCloud