How to scan for new disk in Linux(Redhat) without rebooting?.......................TIA.

Discussion in 'Storage' started by Boll Weevil, Dec 14, 2004.

  1. Boll Weevil

    Boll Weevil Guest

    I'll adding new disk from the EMC SAN and I am wondering if it's possible to
    able to
    mount the new disk without rebooting. So far fdisk or sfdisk will not see the
    newly presented disk with a reboot.
    Boll Weevil, Dec 14, 2004
    1. Advertisements

  2. In Versions < Linux 2.6 that's racy and may crash your machine,
    especially if it's under heavy SCSI I/O load.
    Christoph Hellwig, Dec 15, 2004
    1. Advertisements

  3. In Versions < Linux 2.6 that's racy and may crash your machine,
    How to do this in Windows - probably will be interesting for somebody.

    On NT4, just run WINDISK (Disk Administrator), it rescans all SCSI/IDE busses
    on startup.

    On w2k and later, go to Device Manager and say "Scan For Hardware Changes". Or
    download the free DEVCON.EXE tool from to do the same from
    command line.

    Nothing racy. :)

    Detaching the disk devices. Impossible on NT4, Device Manager/Disable or Device
    Manager/Uninstall (or DEVCON) on w2k and later. Note that if dismount of the
    filesystems on this disk fails due to open files on them, then Windows will
    suggest you to reboot immediately - such a funny feature of the Device Manager
    UI :). You can neglect to reboot, but, on next reboot, the disk will be

    The rest of the detach procedure depends on your hardware.
    Maxim S. Shatskih, Dec 15, 2004
  4. BTW, why do you think you would be able to unload the driver module when it is busy ?
    Yura Pismerov, Dec 16, 2004
  5. Boll Weevil

    Don Khan Guest

    It has also not been very reliable. It does not seem to work for adding new
    LUNs to an existing target, something you will end up doing in a SAN
    environment. In fact depending on the driver it may never work. I could not
    even get the emulex driver to add new targets or LUNs, same for the Qlogic
    cards. This is something I hope would be fixed in the 2.6 kernel. Most
    modern operating systems supprot dynamic device reconfiguration (without
    unloading the hba driver). Solaris, AIX, HP-UX, Dynix, Windows 200x all have
    this feature.

    Don Khan, Dec 17, 2004
  6. unloading the hba driver). Solaris, AIX, HP-UX, Dynix, Windows 200x all have
    NT4 can dynamically load new HBA drivers and detect new devices, but cannot
    handle removal.
    Maxim S. Shatskih, Dec 17, 2004
  7. Funny, I am currently fighting DS4300 connected to pair of Qlogic 2312 HBAs...
    What a coincidence ! :)
    As for the topic, would not scsiadd do the job ?
    I never tried it on FC hardware, but it always worked fine for regular SCSI devices.
    Yura Pismerov, Dec 17, 2004
  8. Boll Weevil

    Drink_Chai Guest

    EMC has this in the their knowedgebase for: "How to add new / remove used LUNs without rebooting Linux server"

    printf "scsi remove-single-device %d %d %d %d" $controller $bus $target
    $lun >>/proc/scsi/scsi

    printf "scsi add-single-device %d %d %d %d" $controller $bus $target
    $lun >>/proc/scsi/scsi
    Drink_Chai, Dec 21, 2004
  9. Hi Boll,

    this is from the source-code qla-driver readme:

    8.5 Hot Add new LUNs

    This version supports hot adding new luns, etc. Please see text below on how
    to perform the lun hot add procedure. The latest driver-v7.00.60-fo has the
    mechanism which allows the user to force the driver to do re-scan of the
    devices to allow a new device to be added. This triggers the driver to
    initiate lun discovery process.

    To do this from the command line:
    #echo "scsi-qlascan" > /proc/scsi/<driver-name>/<adapter-id> (qlogic
    driver will re-scan)

    Where <driver-name> can be either one : qla2100/qla2200/qla2300 <adapter-id>
    ~ is the instance number of the HBA.

    Once that has been done , user then can force the scsi mid layer to do
    its own scan
    and build the device table entry for the new device:
    # echo "scsi add-single-device 0 1 2 3" >/proc/scsi/scsi
    (scsi mid layer will re-scan) with "0 1 2 3"
    replaced by your "Host Channel Id Lun". The scanning has to be done in
    the above mentioned order.

    First the driver (qla2300/qla2200 driver etc) and then the Linux scsi
    mid layer.

    You take a look into "dmesg | less" and search for the information about
    "Host Channel Id Lun", the Lun you have to know, from the Storage

    echo "scsi-qlascan" > /proc/scsi/qla2200/1
    echo "scsi-qlascan" > /proc/scsi/qla2200/2

    echo "scsi add-single-device 1 0 0 6" >/proc/scsi/scsi

    than take a look into "cat /proc/partions" if the pation is not there
    you can do a "partprobe" (man partprobe).
    Stefan Schluppeck, Jan 29, 2005
  10. Boll Weevil

    Don Khan Guest

    I'm wondering how this method affects the currently configured devices. For
    example if host/channel/id/lun 0 1 1 2 is configured as /dev/sdb and 0 1 1
    1 is then added. What device name is going to be used, the next device name
    say /dev/sdc or does /dev/sdb now point to 0 1 1 1 and /dev/sdc points to 0
    1 1 2. A similar situation is needed if a device is now removed. Do the
    /dev/sd entries move up or do they remain unchanged. I'll have to test this,
    in either case I'm more interested in the behavior on the 2.6 kernels.

    Don Khan, Jan 30, 2005
  11. When doing a bus reprobe already claimed devices remain unchanged.
    Christoph Hellwig, Jan 30, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.