Skip to content

Instantly share code, notes, and snippets.

@ryanmoon
Created February 22, 2017 01:04
Show Gist options
  • Save ryanmoon/79c2c245ff625a4c64564ff4edb0ccba to your computer and use it in GitHub Desktop.
Save ryanmoon/79c2c245ff625a4c64564ff4edb0ccba to your computer and use it in GitHub Desktop.
Fix for Xsan Automounting Issues
#!/bin/bash
####################
# Automount Fixer
####################
# Install outset
# Place this script with an .sh in /usr/local/outset/boot-every
# Automount problems solved-ish
# Ryan Moon
# Diskutil value should be set to your ideal value from the output of diskutil list | wc -l
# San_name should be set to the name of your SAN
# Profit
main() {
diskutil_value=""
san_name=""
osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')
if [[ "$osx_vers" -ge 11 ]]; then
echo "Starting Now at $(date)" >> /var/log/outset.log
while [[ $(diskutil list | wc -l ) -lt "$diskutil_value" ]]; do
echo "Waiting for SAN volumes to appear, at $(date)" >> /var/log/outset.log
sleep 30
done
echo "SAN is ready to mount at $(date)" >> /var/log/outset.log
/usr/sbin/xsanctl mount "$san_name"
while [[ $(mount | awk '$3 == "/Volumes/$san_name" {print $3}') = "$diskutil_value" ]]; do
/usr/sbin/xsanctl mount "$san_name"
done
fi
exit
}
# Script
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment