From 1fe530f05431dc04efe020bafac84e6124d0a9cf Mon Sep 17 00:00:00 2001 From: Jeff Lane Date: Thu, 12 Apr 2018 15:50:17 -0400 Subject: Fixes bug when running on LVM (and presumably any mapper device since we're trying to get out size from the wrong field in the output). LP: #1763497 --- bin/disk_stress_ng | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/disk_stress_ng b/bin/disk_stress_ng index df5694e..3668f63 100755 --- a/bin/disk_stress_ng +++ b/bin/disk_stress_ng @@ -103,7 +103,7 @@ find_largest_partition() { largest_size=0 mapper_string="dm-" if [ "${disk_device#*$mapper_string}" = "$disk_device" ]; then - partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ") + partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep -E 'part|lvm' | tr -s " ") else partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device) fi @@ -113,7 +113,7 @@ find_largest_partition() { part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2) part_location="/dev/$partition" elif [ -b "/dev/mapper/$partition" ]; then - part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 3) + part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2) part_location="/dev/mapper/$partition" else echo "$partition not found!" -- cgit v1.2.3