Skip to content

Instantly share code, notes, and snippets.

@fiskn
Created August 22, 2016 13:19
Show Gist options
  • Select an option

  • Save fiskn/4070302063fe52a5bf1e0cb3cb02e67e to your computer and use it in GitHub Desktop.

Select an option

Save fiskn/4070302063fe52a5bf1e0cb3cb02e67e to your computer and use it in GitHub Desktop.
Lists osd to disk serial numbers, useful for finding failed disks in 12x3.5" in 1U servers
#!/bin/bash
DISKS=`ceph-disk list | grep "ceph data"`
old_IFS=$IFS
IFS=$'\n'
#echo $DISKS
for DISK in $DISKS; do
DEV=`awk '{print $1}' <<< $DISK`
OSD=`awk '{print $7}' <<< $DISK`
DEV=`echo $DEV | sed -e 's/\/dev\///g'`
ID=`ls -l /dev/disk/by-id | grep $DEV | awk '{print $9}' | egrep -v "wwn"`
echo $OSD $ID
done
IFS=$old_IFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment