svn commit: r222079 - head/usr.sbin/pc-sysinstall/backend

Josh Paetzel jpaetzel at FreeBSD.org
Wed May 18 20:38:29 UTC 2011


Author: jpaetzel
Date: Wed May 18 20:38:28 2011
New Revision: 222079
URL: http://svn.freebsd.org/changeset/base/222079

Log:
  Wipeout the end of disks, home to things like gmirror metadata, backup GPT tables,
  and other potential evil.
  
  Submitted by:	Kris Moore <kris at pcbsd.org>
  Approved by:	kib (mentor)
  Sponsored by:	iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==============================================================================
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh	Wed May 18 20:29:07 2011	(r222078)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh	Wed May 18 20:38:28 2011	(r222079)
@@ -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;}'`"
 } ;
 
 


More information about the svn-src-all mailing list