Your initial question already has a few good answers, so i'll focus on the background to your question, labeling disks.
I use the drive's serial number to print labels for hot swap bays - it's the best way to uniquely and consistently identify the drive. It won't change regardless of which bay, or which controller it is plugged in to.
You don't mention whether you're using Linux or some other Unix, but in Linux you can get a list of disks (and partitions, which we want to exclude) with their brand, model, and serial number by looking in the /dev/disk/by-id/ directory. I find the following bash alias useful for this:
alias list_disks='find /dev/disk/by-id/ -iname 'scsi-*' | grep -v -- -part | while read disk ; do echo $(readlink $disk | sed -e s:../../:: ) $(basename $disk); done'
(matching for scsi-*
finds all "scsi-like" drives, including SATA and SAS drives. on systems with only SATA drives, ata-*
would work as well)
e.g. on one of my ZFS server systems, it produces output like this:
# list_disks | sort
sdb scsi-SATA_WDC_WD10EACS-00Z_WD-WCASJ2195141
sdc scsi-SATA_WDC_WD10EACS-00Z_WD-WCASJ2114122
sdd scsi-SATA_ST31000528AS_9VP4P4LN
sde scsi-SATA_ST31000528AS_6VP3FWAG
sdf scsi-SATA_ST31000528AS_9VP509T5
sdg scsi-SATA_ST31000528AS_9VP4RPXK
sdh scsi-SATA_OCZ-VECTOR_OCZ-0974C023I4P2G1B8
sdi scsi-SATA_OCZ-VECTOR_OCZ-8RL5XW08536INH7R
sdj scsi-SATA_ST31000528AS_9VP18CCV
sdk scsi-SATA_WDC_WD10EARS-00Y_WD-WMAV50933036
As you can see, the /dev/disk/by-id listing includes each drive's brand and model number, as well as the serial number. They're all SATA drives plugged into either SATA ports or SAS ports on an LSI SAS-2008 controller.
If I had a label printer attached, it would be easy enough to print labels based on the output of list_disks
. I used an old manual label-writer instead because that's what I had. The printed labels contain only the serial number without the brand/model (that's enough for me to identify the drive when I need to). The labels come in very handy when a drive fails and needs to be replaced.