Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Print the serial number of your disks with this script
ls /dev/disk/by-id/ata* | sed -e '/-part[0-9]*$/d;s/.*_//' | while read SERIAL;
do
DEVICE=$(readlink -f /dev/disk/by-id/ata*${SERIAL});
echo ${DEVICE}" "${SERIAL};
done | sort;