Add startup confirmation to disk utilities

This commit is contained in:
dido committed 2026-09-27 12:53:24 +03:00
1 parent c777cf115b
commit 33c4229848
5 files changed
+48 -1

No files matched your search

+5 -1
View File
@@ -20,7 +20,11 @@ Erase, Overwrite. За ATA избира Enhanced Security Erase, ако устр
потвърждения, като второто е точното име на устройството.
**Изтриването е необратимо и при режим за цял диск засяга всички дялове.**
Не прекъсвай захранването или връзката с диска. При прекъсване на ATA
В началото скриптът предупреждава, че работата може да продължи часове, и
изисква `yes` за продължаване или `no` за прекратяване. Не изключвай,
рестартирай или приспивай компютъра и не прекъсвай захранването или връзката
с диска. За дял следва отделно потвърждение с точния device path; за цял диск
следват две допълнителни потвърждения. При прекъсване на ATA
Security Erase устройството може да остане заключено с временната парола,
посочена в съобщението за грешка. Secure Erase/Sanitize зависи от коректната
реализация във firmware на устройството; скриптът не може да гарантира
+5
View File
@@ -15,6 +15,8 @@ Usage: sudo ./HDD/erase-storage.sh DEVICE [zero|random]
For a partition, writes one full pass of zeros (default) or pseudorandom data.
For a whole disk, detects and runs a supported ATA Secure Erase or NVMe Sanitize
operation. Whole-disk erasure requires two separate confirmations.
At startup, asks you to confirm that you can keep the computer and drive
powered and connected for the hours the operation may take.
Arguments:
DEVICE Partition (for example /dev/sda1) or whole disk
@@ -51,6 +53,9 @@ case "$FILL_MODE" in
;;
esac
common::log "WARNING: Erasing data may take hours. Do not power off, reboot, or suspend the computer, or disconnect power or the drive."
common::confirm "Can the computer and drive remain powered and connected until the operation finishes?" || exit 0
for required_command in findmnt lsblk readlink swapon date dd sleep; do
common::require_cmd "$required_command"
done
+6
View File
@@ -16,6 +16,12 @@
Ако дъщерно устройство не може да се демонтира, скриптът прекратява
операцията.
В началото скриптът предупреждава, че работата може да продължи часове, и
изисква отговор `yes` за продължаване или `no` за прекратяване. По време на
целия процес не изключвай компютъра, не го рестартирай/приспивай и не
прекъсвай захранването или връзката с диска. Преди самия запис има отделно
потвърждение с `YES`.
Използвай само с правилно идентифициран диск, който можеш безопасно да
изтриеш. Изисква пряка SATA връзка; `smartctl` не използва `-d sat`, затова
USB адаптер може да изисква ръчна промяна на извикванията в скрипта.
+5
View File
@@ -16,6 +16,8 @@ Usage: sudo ./HDD/repair-hdd.sh DEVICE [zero|null|random]
Overwrites the selected disk, then runs a SMART extended self-test. This
destroys all data on DEVICE. Use only with a directly connected SATA disk;
USB adapters may require adding -d sat to the smartctl calls.
At startup, asks you to confirm that you can keep the computer and drive
powered and connected for the hours this operation may take.
Arguments:
DEVICE Whole-disk block device, for example /dev/sdX
@@ -55,6 +57,9 @@ case "$FILL_MODE" in
;;
esac
common::log "WARNING: This operation may take hours. Do not power off, reboot, or suspend the computer, or disconnect power or the drive."
common::confirm "Can the computer and drive remain powered and connected until this operation finishes?" || exit 0
for required_command in findmnt lsblk readlink swapon mkdir date tee smartctl grep umount dd sync sleep head base64; do
common::require_cmd "$required_command"
done