Q. How do I force fdisk to see new fiber channel attached disk LUNs without rebooting my Linux server or system?
A. Hot swapping or hot plugging is the ability to remove and replace components of a machine, usually a computer, while it is operating. Once the appropriate software is installed on the computer, a user can plug and unplug the component without rebooting.
You can add new SCSI device to a Linux system through SCSI hotplug mechanism.
Type the following command as root user:
$ echo "scsi add-single-device 1 2 3 4">/proc/scsi/scsi
Where,
- 1 - HBA number
- 2 - channel id on the HBA
- 3 - SCSI ID of the new device
- 4 - LUN of the new device
You need to replace 1,2,3,4 with actual values or parameters as per above list.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop











{ 4 comments… read them below or add one }
A cautionary note. I found that using the posted command to bring a Quantum SDLT scsi tape drive on line if it went off line for some reason, would cause it to negotiate at a lower than maximum trasfer speed. I don’t know if this happens with other devices or why it happens. The way I got around it was to reload the driver (asumming a klm).
av
A better alternative is to use the utility from q-logic “ql-dynamic-tgt-lun-disc-1.8.tgz”
* 1 – HBA number
* 2 – channel id on the HBA
* 3 – SCSI ID of the new device
* 4 – LUN of the new device
how we will get these information from system. pls give more clarity on this part.
You can try the script I wrote below:
#!/usr/bin/perl
#####################################################################
#
# Quick Perl Script to scan for Fiber LUNs without restarting Linux
#
#####################################################################
opendir(NS, “/sys/class/scsi_host”);
@ns=readdir(NS);
closedir(NS);
shift @ns;
shift @ns;
foreach $ns(@ns) {
open(DAT,”>/sys/class/scsi_host/$ns/scan”) || die(“Cannot Open File”);
print DAT “- – -”;
close(DAT);
}
exit;