-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtouch-test
More file actions
34 lines (27 loc) · 787 Bytes
/
touch-test
File metadata and controls
34 lines (27 loc) · 787 Bytes
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
#!/bin/bash
# Usage: touch-test
# Touches and deletes a file on each of the locally mounted file systems.
# This can help point out read-only mounts and poorly performing mounts.
# Run as root
[ "$EUID" -eq 0 ] || {
echo 'Please run with sudo or as root.'
exit 1
}
TEST_FILE='touch-test-file'
START=$(date)
START_SECONDS=$(date +%s)
for MOUNT in $(df -lP | egrep -v '^Filesystem|tmpfs' | awk '{print $NF}')
do
TEST_FILE_ON_MOUNT="${MOUNT}/${TEST_FILE}"
echo "$(date) - Touching $TEST_FILE_ON_MOUNT"
touch $TEST_FILE_ON_MOUNT
rm $TEST_FILE_ON_MOUNT
echo "$(date) - Removed $TEST_FILE_ON_MOUNT"
done
END=$(date)
END_SECONDS=$(date +%s)
TOTAL_SECONDS=$(($END_SECONDS - $START_SECONDS))
echo
echo "Start: $START"
echo "End: $END"
echo "Total: $TOTAL_SECONDS seconds"