Skip to content

Instantly share code, notes, and snippets.

@rbenigno
Last active April 27, 2017 20:29
Show Gist options
  • Save rbenigno/23b4c09cd1d33c95999bf9ff8620d1b6 to your computer and use it in GitHub Desktop.
Save rbenigno/23b4c09cd1d33c95999bf9ff8620d1b6 to your computer and use it in GitHub Desktop.
Configure DM Multipath (RHEL 6.2+) and udev rules (RHEL 6.x, 7.x) for Pure Storage
#!/bin/bash
# Create default multipath.conf
[[ -f "/etc/multipath.conf" ]] && read -r -p "/etc/multipath.conf exists. Continue? [y/N] " response
if [[ "$response" =~ ^(no|n)$ ]]; then
echo "Quitting."
exit 1
else
echo "Writing /etc/multipath.conf"
cat << EOF > "/etc/multipath.conf"
defaults {
find_multipaths yes
polling_interval 10
user_friendly_names no
}
devices {
device {
vendor "PURE"
path_selector "queue-length 0"
path_grouping_policy multibus
path_checker tur
fast_io_fail_tmo 10
dev_loss_tmo 60
no_path_retry 0
}
}
blacklist {
device {
vendor "LSI"
product ".*"
}
devnode "^emcpower[a-z]"
device {
vendor "EMC"
product ".*"
}
device {
vendor "DGC"
product ".*"
}
}
EOF
fi
# Create udev rules for Pure storage
[[ -f "/etc/udev/rules.d/99-pure-storage.rules" ]] && read -r -p "/etc/udev/rules.d/99-pure-storage.rules exists. Continue? [y/N] " response
if [[ "$response" =~ ^(no|n)$ ]]; then
echo "Quitting."
exit 1
else
echo "Creating /etc/udev/rules.d/99-pure-storage.rules"
cat << EOF > "/etc/udev/rules.d/99-pure-storage.rules"
# Recommended settings for Pure Storage FlashArray.
# Use noop scheduler for high-performance solid-state storage
ACTION=="add|change", KERNEL=="sd*[!0-9]", SUBSYSTEM=="block", ENV{ID_VENDOR}=="PURE", ATTR{queue/scheduler}="noop"
# Reduce CPU overhead due to entropy collection
ACTION=="add|change", KERNEL=="sd*[!0-9]", SUBSYSTEM=="block", ENV{ID_VENDOR}=="PURE", ATTR{queue/add_random}="0"
# Spread CPU load by redirecting completions to originating CPU
ACTION=="add|change", KERNEL=="sd*[!0-9]", SUBSYSTEM=="block", ENV{ID_VENDOR}=="PURE", ATTR{queue/rq_affinity}="2"
# Set the HBA timeout to 60 seconds
ACTION=="add", SUBSYSTEMS=="scsi", ATTRS{model}=="FlashArray ", RUN+="/bin/sh -c 'echo 60 > /sys/\$DEVPATH/device/timeout'"
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment