While surfing for information on hashing hard drives, I stumbled across
Here are the instructions
# Download or obtain a Linux boot CD.
# Download the csh script cal-drive.csh.
# Copy cal-drive.csh to removable media.
# Select a storage device to become the reference drive. Please be sure that the drive contains no data, since everything on the drive will be lost.
# Determine the size of the drive in sectors.
# Select a computer.
# Prepare the computer to boot set the BIOS boot order to CD first, insert CD and attach storage device.
# Boot the computer.
# If the Linux CD does not boot, diagnose the problem and repeat until linux boots.
# After a Linux environment is established, determine the device name of the reference drive. If it is a USB, Firewire or SCSI it will likely be one of sda, sdb, etc. If the drive is ATA (aka IDE), the name will likely be hda, hdb, etc.
# Mount the removable media that contains cal-drive.csh.
# Execute the script to create the reference drive. If the device name of the reference drive is /dev/sda then the command is cal-drive.csh sda
# This may take some time to finish.
And here is the script
#!/bin/csh
set root = '/dev'
if (!(($#argv == 2) || ($#argv == 1))) then
echo "There are $#argv parameters, there should be 1 or 2"
echo "Usage cal-drive.csh DEVICE [NUMBER_OF_SECTORS]"
exit 1
endif
set logfile = "cal-log.txt"
set dev = $1
set n = 00000
if ($#argv == 2) set n = $2
set pat = "abcdeZYXWV091827"
echo "Calibrate Drive log file ($logfile)" > $logfile
date >> $logfile
echo "Using drive $dev" >> $logfile
dmesg | grep $dev >> $logfile
#
dmesg | grep $dev > /dev/null
set dev_not_found = $status
dmesg | grep $dev | grep sector > /dev/null
set cnt_not_found = $status
if (!($cnt_not_found)) then
set n = `dmesg | grep $dev | grep sector | sed -e 's/^.* //' -e 's/ .*$//'`
echo "$root/$dev has $n sectors"
echo "$root/$dev has $n sectors" >> $logfile
endif
dmesg | grep $dev | grep $n > /dev/null
set cnt_not_match = $status
if ($dev_not_found) then
echo "Note $dev not in dmesg output"
echo "Note $dev not in dmesg output" >> $logfile
else
if ($cnt_not_match) then
echo "Note $dev does not report $n sectors"
echo "Note $dev does not report $n sectors" >> $logfile
dmesg | grep $dev
endif
endif
#
echo "This script will overwrite the drive on $root/$dev"
echo "Everything on the drive $root/$dev WILL BE LOST"
echo -n "Do you want to continue? [yes|no] "
set answer = $<
echo "The answer to continue? yes or no is $answer" >> $logfile
if (($answer != "yes") && ($answer != "y")) then
echo "Ending procedure without wipe"
echo "Ending procedure without wipe" >> $logfile
else
set target = `yes $pat | dd bs=512 count=$n | md5sum | tr a-z A-Z`
yes $pat | dd bs=512 count=$n > $root/$dev
echo "MD5 should be $target"
echo "MD5 should be $target" >> $logfile
echo -n "MD5 on drive is "
echo -n "MD5 on drive is " >> $logfile
md5sum < $root/$dev | tr a-z A-Z | tee md5.txt
cat md5.txt >> $logfile
set target = `yes $pat | dd bs=512 count=$n | sha1sum | tr a-z A-Z`
echo "SHA1 should be $target"
echo "SHA1 should be $target" >> $logfile
echo -n "SHA1 on drive is "
sha1sum < $root/$dev | tr a-z A-Z | tee sha.txt
echo -n "SHA1 on drive is " >> $logfile
cat sha.txt >> $logfile
endif