fix: reorder wipe method fallback sequence
This commit is contained in:
@@ -17,11 +17,11 @@ description: mtm-ddwipe project conventions
|
||||
- Keep optional tools optional.
|
||||
- Use extra wipe methods only if the command is present.
|
||||
- Use `ddrescue` or `dd_rescue` only after `dd` fails.
|
||||
- Keep `nvme-cli` and `hdparm` optional.
|
||||
- Keep `nvme` and `hdparm` optional.
|
||||
- Use `nvme` and `hdparm` only on matching device types.
|
||||
- Do not make new external tools required.
|
||||
- Keep changes minimal and preserve intent.
|
||||
- Keep `./continue/rules/project.md` aligned and concise.
|
||||
- Keep this file aligned and concise.
|
||||
- If non-interactive support is added, make it an opt-in safety flag.
|
||||
|
||||
# Project identity
|
||||
|
||||
@@ -1,2 +1,14 @@
|
||||
# mtm-ddwipe
|
||||
|
||||
Wipe a block device.
|
||||
|
||||
Warning: destructive and irreversible. The target must be a real block device, not mounted, and not in use.
|
||||
|
||||
Usage:
|
||||
mtm-ddwipe DEVICE
|
||||
|
||||
Options:
|
||||
- `-h`, `--help`
|
||||
|
||||
Optional tools: `blkdiscard`, `ddrescue`, `dd_rescue`, `nvme`, `hdparm`.
|
||||
|
||||
|
||||
+16
-17
@@ -14,9 +14,8 @@ Wipe a block device.
|
||||
|
||||
Warnings:
|
||||
- Destructive and irreversible.
|
||||
- Target must not be mounted or in use.
|
||||
- Optional tools: blkdiscard, ddrescue, dd_rescue, nvme-cli, hdparm.
|
||||
- nvme and hdparm need matching device types.
|
||||
- Target must be a real block device, not mounted, and not in use.
|
||||
- Optional tools: blkdiscard, ddrescue, dd_rescue, nvme, hdparm.
|
||||
- dd fallback may take a long time.
|
||||
|
||||
Version: ${VERSION}
|
||||
@@ -217,20 +216,6 @@ wipe_dev() {
|
||||
return
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if wipe_with_nvme "$dev"; then
|
||||
echo ""
|
||||
log "Device $dev wiped."
|
||||
return
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if wipe_with_hdparm "$dev"; then
|
||||
echo ""
|
||||
log "Device $dev wiped."
|
||||
return
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if wipe_with_dd "$dev"; then
|
||||
echo ""
|
||||
@@ -252,6 +237,20 @@ wipe_dev() {
|
||||
return
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if wipe_with_nvme "$dev"; then
|
||||
echo ""
|
||||
log "Device $dev wiped."
|
||||
return
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if wipe_with_hdparm "$dev"; then
|
||||
echo ""
|
||||
log "Device $dev wiped."
|
||||
return
|
||||
fi
|
||||
|
||||
die "Wipe failed. The device may not be fully overwritten."
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user