/usr/share/checkbox/scripts/storage_test is in checkbox 0.13.7.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #!/bin/bash
# take the path of the storage device and test is it a block device.
function run_bonnie() {
echo "Running bonnie++ on $1..."
# Determine where to put the scratchdisk
mount_point=$(df -h | grep $1 | awk '{print $6}')
echo "Putting scratch disk at $mount_point"
mkdir -p "$mount_point/tmp/scratchdir"
bonnie++ -d "$mount_point/tmp/scratchdir" -u root
}
disk=/dev/$1
if [ -b $disk ]
then
echo "$disk is a block device"
size=`parted -l | grep $disk | awk '{print $3}'`
if [ -n "$size" ]
then
echo "$disk reports a size of $size."
# Have to account for the end of the size descriptor
size_range=${size:(-2)}
if [ $size_range == "KB" ]
then
echo "$disk is too small to be functioning."
exit 1
elif [ $size_range == "MB" ]
then
size_int=${size::${#size}-2}
if [ $size_int -gt 10 ]
then
run_bonnie $disk
else
echo "$disk is too small to be functioning."
exit 1
fi
else
run_bonnie $disk
fi
else
echo "$disk doesn't report a size."
exit 1
fi
else
echo "$disk is not listed as a block device."
exit 1
fi
|