43 lines
2.3 KiB
Bash
Executable File
43 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# ============================================================
|
|
# disk-recovery.sh — Disk recovery and flash-testing tools
|
|
# ============================================================
|
|
# Installs two complementary data-recovery/storage-testing tools:
|
|
#
|
|
# ddrescue — GNU ddrescue: robust block-level disk imaging tool
|
|
# that retries bad sectors and creates a recovery log
|
|
# so interrupted rescues can be resumed. Available in
|
|
# the official Arch repos.
|
|
#
|
|
# f3 — Fight Flash Fraud: tests USB drives and SD cards for
|
|
# counterfeit capacity by writing and verifying data.
|
|
# Available from AUR only.
|
|
#
|
|
# These are optional because they are specialist tools most users
|
|
# only reach for when something has gone wrong (failing drive,
|
|
# suspected fake flash storage).
|
|
# ============================================================
|
|
|
|
set -euo pipefail
|
|
# Load shared logging helpers from the dotfiles lib
|
|
source "$(dirname "${BASH_SOURCE[0]}")/../../lib/logging.sh"
|
|
|
|
# ── ddrescue (official repos) ─────────────────────────────────────────────────
|
|
# ddrescue copies data from a failing or damaged disk to an image file,
|
|
# intelligently skipping bad sectors and retrying them later. The recovery
|
|
# log (mapfile) enables resuming after an interruption without re-reading
|
|
# already-good sectors. Preferred over dd for data recovery because it
|
|
# maximises the amount of data recovered from a partially readable drive.
|
|
log "Installing ddrescue..."
|
|
sudo pacman -S --noconfirm --needed ddrescue
|
|
|
|
# ── f3 (AUR) ─────────────────────────────────────────────────────────────────
|
|
# f3 (Fight Flash Fraud) reveals counterfeit storage devices that report a
|
|
# larger capacity than they actually have. It works by filling the device
|
|
# with unique data then reading it back to find where corruption starts.
|
|
# Useful before trusting a newly purchased USB drive or SD card.
|
|
log "Installing f3 (AUR)..."
|
|
yay -S --answerdiff None --answerclean All --noconfirm f3
|
|
|
|
log "Disk recovery tools installed."
|