Skip to content

Instantly share code, notes, and snippets.

@rickardrosen
Last active July 5, 2019 20:49
Show Gist options
  • Save rickardrosen/2effa5e5b65a4d8fb26b9ef001063be4 to your computer and use it in GitHub Desktop.
Save rickardrosen/2effa5e5b65a4d8fb26b9ef001063be4 to your computer and use it in GitHub Desktop.
Locate drive
#!/bin/bash
udevadm info --query=all --name=/dev/$1 | grep -A3 -B9 SERIAL
pos=($(sas2ircu 0 display | grep -B9 $(udevadm info --query=all --name=/dev/$1 | grep ID_SCSI_SERIAL | awk -F "=" '{print $2}') | grep -Ei 'Enclosure|Slot' | awk -F ":" '{print $2}' | tr -d [:blank:]))
sas2ircu 0 locate ${pos[0]}:${pos[1]} ON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment