diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-27 06:21:28 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-27 06:21:28 -0600 |
| commit | 7fe0b222bde382e793d14418625375b1bf330141 (patch) | |
| tree | ab9f6fb09a54ab67fe461bd635b18663c37a9708 /scripts/wipedisk | |
| parent | 2923dba9ebc81b0691398ae54eb3afdc1d1844fe (diff) | |
chore: move arch-distrobox and wipedisk to scripts
Diffstat (limited to 'scripts/wipedisk')
| -rw-r--r-- | scripts/wipedisk | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/wipedisk b/scripts/wipedisk new file mode 100644 index 0000000..0c08c72 --- /dev/null +++ b/scripts/wipedisk @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Craig Jennings <c@cjennings.net> +# identify disk and erase + +all_disk_ids=( $(ls /dev/disk/by-id/) ) +echo ""; echo "Select the disk id to use. All data will be erased." +select disk_id in "${all_disk_ids[@]}"; do + # ensure valid selection + if [[ -n $disk_id ]]; then + selection=$disk_id + break + else + echo "Invalid. Try again." + fi +done + +# Confirm the selected disk +read -p "Confirm: '$selection' [y/n]? " choice +if [[ "$choice" != "y" ]]; then + echo "Exiting..." + exit 1 +fi + +DISK="/dev/disk/by-id/$selection" +echo ""; echo "### Erasing Disk" +blkdiscard -f "${DISK}" || true # discard all sectors on flash-based storage +sgdisk --zap-all "${DISK}" # clear the disk + +echo "" +echo "Disk erased."
\ No newline at end of file |
