diff options
| author | Jeff Lane <jeffrey.lane@canonical.com> | 2018-04-12 15:50:17 -0400 |
|---|---|---|
| committer | Jeff Lane <jeffrey.lane@canonical.com> | 2018-04-12 15:50:17 -0400 |
| commit | 1fe530f05431dc04efe020bafac84e6124d0a9cf (patch) | |
| tree | 4ef65fa0b2382d27dc698fe7fbb1d95970e6897e | |
| parent | c03d17f0da19be9a7f5e2e6ff6bb72441c863f53 (diff) | |
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
| -rwxr-xr-x | bin/disk_stress_ng | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/disk_stress_ng b/bin/disk_stress_ng index df5694e9..3668f634 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!" |
