Browse Source

Implemented alternative more secure method to erase disk signatures

Matteo Savatteri 5 years ago
parent
commit
fecb80070c
1 changed files with 5 additions and 3 deletions
  1. 5 3
      newdisk-automator.sh

+ 5 - 3
newdisk-automator.sh

@@ -41,9 +41,11 @@ if pvs | grep --quiet "${DEVICE}" ; then
 		exit ${LVMPV_E}
 	fi
 
-	# removing lvm
-	vgremove -f $(vgs --noheadings --select pv_name=~"${DEVICE}" -o vg_name)
-	pvremove $(pvs --noheadings --select pv_name=~"${DEVICE}" -o pv_name)
+	# removing lvm and other filesystem signatures)
+	echo "Eresing disk signatures..."
+	vgchange -an $(vgs --noheadings --select pv_name=~"${DEVICE}" -o vg_name)
+	wipefs -a ${DEVICE}[[:digit:]]*
+	wipefs -a ${DEVICE}
 fi
 
 echo "SFDISK ----------------------------------------------------"