summaryrefslogtreecommitdiff
path: root/bin
diff options
authorJeff Lane <jeffrey.lane@canonical.com>2017-04-25 19:03:30 -0400
committerJeff Lane <jeffrey.lane@canonical.com>2017-04-25 19:03:30 -0400
commita17dfe4e5b819661bb59245ae94abfec73485535 (patch)
treec9b8ac244ed4c4d8ebd6d8c25733d511b337a85d /bin
parent7519e519749f87e4564acc0fa2460b2226543728 (diff)
bin/disk_stress_ng: modified to use dev/mapper devices on multipath systems LP: #1467520
Diffstat (limited to 'bin')
-rwxr-xr-xbin/disk_stress_ng26
1 files changed, 20 insertions, 6 deletions
diff --git a/bin/disk_stress_ng b/bin/disk_stress_ng
index de96f46..ca0b3b3 100755
--- a/bin/disk_stress_ng
+++ b/bin/disk_stress_ng
@@ -101,21 +101,35 @@ find_largest_lv() {
find_largest_partition() {
largest_part=""
largest_size=0
- partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ")
+ mapper_string="dm-"
+ if [ "${disk_device#*$mapper_string}" != "$disk_device" ]; then
+ partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device)
+ else
+ partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ")
+ fi
unsupported_fs=""
for partition in $(echo "$partitions" | cut -d " " -f 1) ; do
part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2)
- local blkid_info=$(blkid -s TYPE /dev/$partition | grep -E ext2\|ext3\|ext4\|xfs\|jfs\|btrfs\|LVM2_member)
- if [ "$part_size" -gt "$largest_size" ] && [ -n "$blkid_info" ] ; then
+ if [ -b "/dev/$partition" ]; then
+ part_location="/dev/$partition"
+ elif [ -b "/dev/mapper/$partition" ]; then
+ part_location="/dev/mapper/$partition"
+ else
+ echo "$partition not found!"
+ echo "Aborting test"
+ exit 1
+ fi
+ local blkid_info=$(blkid -s TYPE $part_location | grep -E ext2\|ext3\|ext4\|xfs\|jfs\|btrfs\|LVM2_member)
+ if [ "$part_size" > "$largest_size" ] && [ -n "$blkid_info" ] ; then
if [[ "$blkid_info" =~ .*LVM2_member.* ]] ; then
find_largest_lv
else
largest_size=$part_size
- largest_part="/dev/$partition"
- largest_fs=$(blkid -s TYPE "/dev/$partition" | cut -d "=" -f 2)
+ largest_part="$part_location"
+ largest_fs=$(blkid -s TYPE "$part_location" | cut -d "=" -f 2)
fi
fi
- local blkid_info=$(blkid -s TYPE /dev/$partition | grep -E ntfs\|vfat\|hfs)
+ local blkid_info=$(blkid -s TYPE $part_location | grep -E ntfs\|vfat\|hfs)
if [ -n "$blkid_info" ] ; then
# If there's an NTFS, HFS+, or FAT filesystem on the disk make note of it....
unsupported_fs=$(blkid -s TYPE "/dev/$partition" | cut -d "=" -f 2)