RESCAN-SCSI-BUS.SH(8)

πŸ“¦
version 1.49 Β· 4 versions
, in arch rolling, nixpkgs unstable

πŸ’… rescan-scsi-bus.sh β€” like, the whole manual, but make it make sense

okay so bestie, welcome to RESCAN-SCSI-BUS.SH(8) β€” yes that's the manual section 8, we're in User Commands territory, and this little script is genuinely iconic. It's a script that adds and removes SCSI devices without rebooting. no reboot. none. we simply do not reboot in this house. πŸ¦‹


✨ NAME ✨

rescan-scsi-bus.sh β€” a script to add and remove SCSI devices without rebooting πŸŽ€


🌸 SYNOPSIS 🌸

rescan-scsi-bus.sh [--alltargets] [--attachpq3] [-c] [--channels=CLIST]
[--color] [-d] [--flush] [-f] [--forceremove] [--forcerescan] [--help]
[--hosts=HLIST] [--ids=TLIST] [--ignore-rev] [--issue-lip] [-i]
[--issue-lip-wait=SECS] [-I SECS] [-l] [-L NUM] [--largelun]
[--luns=LLIST] [-m] [--multipath] [--no-lip-scan] [--nooptscan]
[--nosync] [--remove] [--removelun2] [--resize] [--sparselun] [--sync]
[--timeout=SECS] [--update] [--version] [--wide] [HOST1 [HOST2 ...]]

like, that's a lot of brackets, but we move. πŸ’…


πŸ”₯ OPTIONS πŸ”₯

real talk first: the options are ordered by their long name. and the ones that don't have a long name? they get ordered as if their single letter was a long name. equality, honestly. we love to see it. ✨

  • -a, --alltargets β€” scan all the targets, not just the ones that currently exist. [default: disabled]
  • --attachpq3 β€” tell the kernel to attach sg to LUN 0 that reports PQ=3. yes, that's a thing, and yes, it's fine. 🫢
  • -c β€” turns on scanning of channels 0 1. [default: 0 / all detected ones]
  • --channels=CLIST β€” scan only the channel(s) in CLIST, bestie. nobody else. πŸŽ€
  • --color β€” coloured prefixes OLD/NEW/DEL, because reading is a visual experience and we deserve nice things.
  • -d β€” enable debug. [default: 0]
  • -f, --flush β€” flush failed multipath devices. [default: disabled]
  • --forceremove β€” remove stale devices. ⚠️ (DANGEROUS) like actually dangerous, bestie, don't just vibe your way into this one.
  • --forcerescan β€” remove and re-add existing devices. ⚠️ (DANGEROUS) same energy, same warning.
  • -h, --help β€” print the usage message, then exit. the classic. πŸ‘‘
  • --hosts=HLIST β€” scan only the host(s) in HLIST.
  • --ids=TLIST β€” scan only the target ID(s) in TLIST.
  • --ignore-rev β€” ignore the (firmware) revision change. it's the third text field (4 bytes long) in a standard INQUIRY response, iykyk. πŸ™ˆ
  • -i, --issue-lip β€” issue a FibreChannel LIP reset. [default: disabled]
  • -I SECS, --issue-lip-wait=SECS β€” issue a FibreChannel LIP reset, and then wait SECS seconds. patience is a virtue, apparently. ⭐
  • -L NUM β€” activates scanning for LUNs 0--NUM. [default: 0]
  • -l β€” activates scanning for LUNs 0--7. [default: 0]
  • --largelun β€” tell the kernel to support LUNs > 7, even on SCSI2 devs. generous of us tbh.
  • --luns=NLIST β€” scan only the lun(s) in NLIST.
  • -m, --multipath β€” update multipath devices. [default: disabled]
  • --no-lip-scan β€” don't scan FC Host when the --issue-lip option is also given.
  • --nooptscan β€” don't stop looking for LUNs if 0 is not found. keep going, king. πŸ”₯
  • --nosync β€” do not issue a sync. [default: sync if remove]
  • -r, --remove β€” enables removing of devices. [default: disabled]
  • --reportlun2 β€” tell the kernel to try REPORT_LUN even on SCSI2 devices.
  • -s, --resize β€” look for resized disks and reload the associated multipath devices, if applicable. glow-up detection πŸ¦‹
  • --sparselun β€” tell the kernel to support sparse LUN numbering.
  • --sync β€” issue a sync. [default: sync if remove]
  • -t, --timeout=SECS β€” timeout for testing if the device is online. the test is skipped if 0. [default: 30 (seconds)]
  • -u, --update β€” look for existing disks that have been remapped.
  • -V, --version β€” shows the version string, then exits. and the version string is a numeric datestamp of the form YYYYMMDD. cute, right? πŸŽ€
  • -w, --wide β€” scan for target device IDs 0--15. [default: 0--7]
so host numbers may thus be specified either directly on the cmd line (deprecated πŸ‘€) or with the --hosts=LIST parameter (recommended πŸ’–). please pick the recommended one, bestie, i'm begging.

🌈 the LIST format, explained 🌈

arguments to options that end in LIST (e.g. TLIST) can have this form:

A[-B][,C[-D]]...

which is a comma separated list of single values and/or ranges. and NO spaces allowed. none. zero. not even one tiny space. πŸ’€


🧚 SEE ALSO 🧚

there's a brief description here, and honestly go read it:

https://fibrevillage.com/storage/585-rescan-scsi-bus-sh-script-for-adding-and-removing-scsi-devices-without-rebooting

sg3_utils Homepage: https://sg.danny.cz/sg

# this is just a redirect, a bit like a symlink.

okay that's the whole thing!! 🫢 no cap, every flag is in there. this page is from rescan-scsi-bus.sh, dated 2026-06-01, and lives at RESCAN-SCSI-BUS.SH(8) in User Commands β€” go forth and rescan, you absolute main character. πŸŽ€πŸ’œ

πŸ“¦ where this page comes from