Skip to content

Commit

Permalink
Merge pull request #380 from findns94/fix_raw_disk_fio
Browse files Browse the repository at this point in the history
setup/fio-setup-basic: fix incorrect raw disk capacity calculation
  • Loading branch information
rli9 authored Aug 8, 2024
2 parents e35bd12 + 7e52b04 commit 240389c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions setup/fio-setup-basic
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,18 @@ fi
[ -z "$storages" ] && die "storages is empty, we can't get jobs_per_storage and nr_task_remain"
for storage in $storages
do
mnt_point=$(stat -c %m $(readlink -f $storage))
available_storage_size=$(df -k | awk '{print $4" "$NF}' | grep $mnt_point$ | awk '{print $1}')
[ -n "$available_storage_size" ] || die "storage $storage doesn't mounted"
available_storage_size=$(to_byte ${available_storage_size}k)
if [ "$raw_disk" = 1 ]; then
# for raw disk, using lsblk to get disk capacity in bytes instead of reading filesystem stats
# because raw disk will not mount filesystem
available_storage_size=$(lsblk -b | grep $(basename $storage) | awk '{print $4}')
[ -n "$available_storage_size" ] || die "device $storage doesn't exist"
else
mnt_point=$(stat -c %m $(readlink -f $storage))
available_storage_size=$(df -k | awk '{print $4" "$NF}' | grep $mnt_point$ | awk '{print $1}')
[ -n "$available_storage_size" ] || die "storage $storage doesn't mounted"
available_storage_size=$(to_byte ${available_storage_size}k)
fi


require_size=$test_size
df | grep $mnt_point$ | awk '{print $1}' | grep -q /dev/pmem && require_size=$size
Expand Down

0 comments on commit 240389c

Please sign in to comment.