Map and locate drives on your SAS backplane from the terminal.
drivefndr is a Bash script for TrueNAS SCALE (or any Linux box) with a SAS expander backplane (tested on AIC 12G 4U24SAS3EOB). It instantly maps /dev/sdX device names to their physical enclosure slot, lets you look up drives by serial number or device label, and prints a clear ASCII slot mapâno GUI required.
If youâve ever wondered âwhich drive is /dev/sdm?â or needed to swap a failed disk without confusion, this tool is for you.
- Lookup by Serial:
Enter the last 4 digits of a serial (case-insensitive) to find its slot and device name. - Lookup by Label:
Enter a Linux device (likesdd) to get serial and slot. - Graphical Slot Map:
Prints a 24-bay ASCII grid: shows drive slot, device name, serial, and size (rounded to nearest TB). - Empty Slot Handling:
Empty slots are shown as âEMPTYâ for easy visual checks. - No Reboot or GUI Needed:
All from a single terminal command. No web UI or browser. - Easily Customizable:
The slot order is stored in a simple mapping arrayâchange it for your chassis in seconds. - Automatic Enclosure Discovery:
Auto-detects available enclosures on first run; lets you pick and remembers your choice. You can re-select from the menu at any time. - User-Configurable Slot Labels and Grid Size:
Set grid size and custom slot display labels at the top of the script, matching any chassis or rack labeling. - Persistent Settings:
Remembers enclosure and label preferences across runs in a local config file.
- TrueNAS SCALE or any modern Linux (Debian/Ubuntu, etc)
- SAS HBA (tested with LSI SAS3008 in IT mode)
- Expander backplane (tested with AIC 12G 4U24SAS3EOB)
- Basic drive labels and/or serials readable by
sg_inqand sysfs - Bash,
sg_inq, coreutils
- Copy
drivefndr.shto your NAS or server. - Make executable:
chmod +x drivefndr.sh
If your system is read-only (like TrueNAS SCALE), you can't symlink scripts into /usr/local/bin.
Instead, create a shell alias so you can call drivefndr globally:
nano ~/.bashrc
alias drivefndr='/root/drivefndr.sh'
source ~/.bashrc
drivefndr
Note:
Any changes you make to /root/drivefndr.sh take effect immediately.

