bin/disktest: create to test disk performance

This commit is contained in:
xeruf 2021-12-16 23:28:41 +01:00
parent e749e78831
commit c7d5702f89
1 changed files with 11 additions and 0 deletions

11
.local/bin/scripts/disktest Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# Test disk performance
# Adapted from https://www.shellhacks.com/disk-speed-test-read-write-hdd-ssd-perfomance-linux/
disk="${1:-$(df --output=source . | tail -1)}"
sudo hdparm -MWAgt "$disk"
if test $# -eq 0
then echo "Write test:"
sync
sudo dd status=progress if=/dev/zero of=tempfile bs=1M count=1K
sudo rm tempfile
fi