diff options
author | jpaetzel <jpaetzel@FreeBSD.org> | 2011-05-18 20:38:28 +0000 |
---|---|---|
committer | jpaetzel <jpaetzel@FreeBSD.org> | 2011-05-18 20:38:28 +0000 |
commit | c284bd0acca4fe2b124844c65d42fe0bfb8f2656 (patch) | |
tree | 6dbabd2aff7bff601c0e3f36ba6eddd96a2f1509 /usr.sbin/pc-sysinstall | |
parent | 305a27a26c0cc376b8e2089f7a273cceed83cb89 (diff) | |
download | FreeBSD-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-x | usr.sbin/pc-sysinstall/backend/functions-disk.sh | 12 |
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;}'`" } ; |