#5089 repair RESET-ALL & deactivate RESET-HDD (#5090)

* repair RESET-ALL & deactivate RESET-HDD
This commit is contained in:
/rootzoll
2025-08-12 14:29:53 +02:00
committed by rootzoll
parent 7c949b3127
commit de9b35cd16
2 changed files with 38 additions and 16 deletions

View File

@@ -87,7 +87,7 @@ fi
OPTIONS+=(REINDEX-UTXO "Redindex Just Bitcoin Chainstate (Fast)") OPTIONS+=(REINDEX-UTXO "Redindex Just Bitcoin Chainstate (Fast)")
OPTIONS+=(REINDEX-FULL "Redindex Full Bitcoin Blockchain (Slow)") OPTIONS+=(REINDEX-FULL "Redindex Full Bitcoin Blockchain (Slow)")
OPTIONS+=(RESET-CHAIN "Delete Blockchain & Re-Download") OPTIONS+=(RESET-CHAIN "Delete Blockchain & Re-Download")
OPTIONS+=(RESET-HDD "Delete HDD Data but keep Blockchain") #OPTIONS+=(RESET-HDD "Delete HDD Data but keep Blockchain")
OPTIONS+=(RESET-ALL "Delete HDD completely to start fresh") OPTIONS+=(RESET-ALL "Delete HDD completely to start fresh")
OPTIONS+=(DELETE-ELEC "Delete Electrum Index") OPTIONS+=(DELETE-ELEC "Delete Electrum Index")
@@ -152,7 +152,8 @@ case $CHOICE in
;; ;;
RESET-ALL) RESET-ALL)
askBackupCopy askBackupCopy
/home/admin/XXcleanHDD.sh -all sudo /home/admin/config.scripts/blitz.data.sh reset OVERWRITE
sleep 3
infoResetSDCard infoResetSDCard
sudo shutdown now sudo shutdown now
exit 1; exit 1;

View File

@@ -2305,23 +2305,44 @@ if [ "$1" = "reset" ]; then
echo "error='no storage device found'" echo "error='no storage device found'"
exit 1 exit 1
fi fi
# ask user to confirm # check ask overide
echo "# WARNING: This will delete all data on ${storageDevice}" if [ "$2" != "OVERWRITE" ]; then
echo "# Are you really sure? (y/n)" # ask user to confirm
read -r answer echo "# WARNING: This will delete all data on ${storageDevice}"
if [ "${answer}" != "y" ]; then echo "# Are you really sure? (y/n)"
echo "# User canceled" read -r answer
exit 1 if [ "${answer}" != "y" ]; then
echo "# User canceled"
exit 1
fi
echo "# Are you REALLY REALLY sure? (Y/N)"
read -r answer
if [ "${answer}" != "Y" ]; then
echo "# User canceled"
exit 1
fi
fi fi
echo "# Are you REALLY REALLY sure? (Y/N)" echo "# Update Tools ..."
read -r answer
if [ "${answer}" != "Y" ]; then
echo "# User canceled"
exit 1
fi
echo "# Deleting all partitions on ${storageDevice} ..."
apt-get install -y gdisk apt-get install -y gdisk
echo "# Stop Bitcoin and umount ..."
swapoff -a
systemctl stop bitcoind
sleep 3
rm -rf /mnt/disk_storage/*
rm -rf /mnt/disk_storage/.[!.]*
rm -rf /mnt/disk_storage/..?*
umount -f /mnt/disk_storage 2>/dev/null
umount -l /mnt/disk_storage 2>/dev/null
umount -f /mnt/disk_data 2>/dev/null
umount -l /mnt/disk_data 2>/dev/null
umount -f /mnt/disk_system 2>/dev/null
umount -l /mnt/disk_system 2>/dev/null
partprobe /dev/${storageDevice}
echo "# Deleting all partitions on ${storageDevice} ..."
wipefs -a /dev/${storageDevice}
sgdisk --zap-all /dev/${storageDevice} sgdisk --zap-all /dev/${storageDevice}
sync
partprobe /dev/${storageDevice}
echo "# DONE" echo "# DONE"
exit 0 exit 0
fi fi