Skip to content

Instantly share code, notes, and snippets.

@rpsene
Created July 21, 2020 14:59
Show Gist options
  • Save rpsene/41ade69f9ff493b0f26c66963b3d8502 to your computer and use it in GitHub Desktop.
Save rpsene/41ade69f9ff493b0f26c66963b3d8502 to your computer and use it in GitHub Desktop.
A simple way to get only the name and size of multipath devices.
multipath -ll | sed -n '/^mpath/,/^size/p' >> /tmp/mpath.log && x=1 && while IFS="" read -r p || [ -n "$p" ]; do STR1=$(printf '%s\n' "$p" | sed 's/\s.*$//'); STR2+=$STR1" "; y=$(($x % 2)); if [ $y -eq 0 ]; then printf '%s\n' "$STR2"; echo "---"; STR2=""; fi; x=$(( $x + 1 )); done < /tmp/mpath.log; rm -f /tmp/mpath.log; touch /tmp/mpath.log;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment