#!/bin/bash # ## Wizard Kit: HW Diagnostics - badblocks function usage { echo "Usage: $0 device log-file" echo " e.g. $0 /dev/sda /tmp/tmp.XXXXXXX/badblocks.log" } # Bail early if [ ! -b "$1" ]; then usage exit 1 fi # Run Badblocks sudo badblocks -sv -e 1 "$1" 2>&1 | tee -a "$2"