scsi_scan_target(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… scsi_scan_target(9) β€” from the Kernel API Manual, bestie

Okay so picture this: you're deep in <pink>drivers/scsi</pink> land and you need to go find a target id and everything chillin' on it. That's this function. It's the little gremlin that goes snooping. Let's get into it πŸ’–


✨ NAME ✨

scsi_scan_target β€” go scan a target id, and honestly possibly all the LUNs sitting on that target too πŸ‘€


✨ SYNOPSIS ✨

void scsi_scan_target (struct device *parent , unsigned int channel ,
       unsigned int id , u64 lun , enum scsi_scan_mode rescan );

Like yes it returns void, no it's not gonna hand you a result, it just does the thing and dips 🫢


✨ ARGUMENTS ✨

  • parent β€” the host you're scanning. Your main character device, basically πŸ‘‘
  • channel β€” the channel you're scanning. Pick your lane bestie 🌈
  • id β€” the target id you're scanning. The actual one we came here for πŸ’…
  • lun β€” either one specific LUN to scan, or SCAN_WILD_CARD if you're feeling unhinged and want the whole menu πŸ“
  • rescan β€” this one gets passed straight down to the LUN scanning routines, so it's like the vibe you're sending:
    • SCSI_SCAN_INITIAL β€” no rescan, fresh start, first-day-of-school energy πŸŽ€
    • SCSI_SCAN_RESCAN β€” rescan the LUNs that already exist, we're going back in πŸ”
    • SCSI_SCAN_MANUAL β€” force scanning even if… ✨
fr fr the original page just stops right there after "even if". No cap, it cliffhangs. I'm not about to invent the rest for you 😭 that's above my pay grade.

✨ DESCRIPTION ✨

So what it's actually doing: scanning the target id on parent, on that channel, and that id. It scans at least LUN 0 β€” LUN 0 is the bare minimum, the non-negotiable, the entry-level icon β€” and possibly all the LUNs on the target id if things go that way 🌸

The strategy, in order, because of course there's an order:

  1. First it tries a REPORT LUN scan. Efficient queen. ✨
  2. If that doesn't scan the target, it falls back to a sequential scan of the LUNs on the target id. Old school but it gets the job done πŸ’ͺ

So it's giving "try the smart way first, brute-force it second." Iconic behavior tbh.


✨ SEE ALSO ✨

Kernel file ./drivers/scsi/scsi_scan.c β€” and the whole extended friend group πŸ’œ


And that's the whole page bestie!! πŸ¦‹ Coming at you live from ./drivers/scsi, dated October 2026 β€” so yeah, mark your calendar, this manpage is from the future πŸ’€βœ¨ mwah, go scan something responsibly πŸŽ€

πŸ“¦ where this page comes from