fdisk -l | grep -i GB | sort > prescan.txt for hst in $(ls /sys/class/scsi_host); do echo "Rescanning $hst..."; echo "- - -" > /sys/class/scsi_host/$hst/scan; done fdisk -l | grep -i GB | sort > postscan.txt diff prescan.txt postscan.txt | grep mapper
Tag Archives: scsi
Retrieving SCSI/LUN IDs from Linux /dev/sd*
Useful to identify disks present before/after a rescan of LUNs:-
for x in `ls -1 /dev/sd*`; do echo -n "$x:"; sudo /sbin/scsi_id -g $x; done > file.txt
The output is then in the format:-
/dev/sdt:360a9800044316f6f543f4646506b334d
Capture output before/after rescan of SCSI bus then use something like this to reveal the newly added LUNs (SCSI IDs):-
sdiff prescan.txt postscan.txt | grep ">" | awk '{ print $2 }' | cut -d":" -f2 | sort -n | uniq