Home > Storage > Adding SAN disk without rebooting

Adding SAN disk without rebooting

Print Friendly, PDF & Email

The production system is running, the database filesystem is almost full. We need more disk space on the server. The server is attached to the San so we can add disk without bringing down the server. In this article, we will demonstrate what is needed to make the new San disk available to the server without disturbing the running application. Although that theses commands have been tested and used on production environment,  I suggest that you build your confidence first, by trying them on a development system.

On Red Hat / Centos 5

In our example, we have presently one disk accessible via one fiber HBA on our server. We can use to “lsscsi” command to list our scsi device. If you do not have the command ‘lsscsi’ command installed, you can install it by issuing the following command “yum install lsscsi”.

Our server can see one disk at the moment ;

#  lsscsi
[0:0:0:0]    disk    HITACHI  OPEN-V           5009   /dev/sda

Let rescan our SCSI bus. Since we have only one fiber card in our server, we will scan only the first HBA (host0). If you have two fiber card, you may need to issue the “partprobe” command for the disk to be seen on the second interface.

# echo "1" > /sys/class/fc_host/host0/issue_lip

We now see the new SAN disk that was newly allocated to the system.

# lsscsi
[0:0:0:0]    disk    HITACHI  OPEN-V           5009   /dev/sda
[0:0:0:1]    disk    HITACHI  OPEN-V           5009   /dev/sdb

For other kind of SCSI attached storage, we should rescan the bus with this command :

# echo "- - -" > /sys/class/scsi_host/host0/scan   (First hba)
# echo "- - -" > /sys/class/scsi_host/host1/scan   (Second hba, if present)

On Red Hat / Centos 3 and 4

The current situation is that we have one disk (lun 2), that is seen by the two fiber cards on our server.

# cd /proc/scsi/sg
# cat device_hdr devices
host    chan    id      lun     type    opens   qdepth  busy    online
0       0       0       2       0       1       64      0       1
1       0       0       2       0       1       64      0       1
#

These commands trigger the driver to initiate lun discovery process

# echo "scsi-qlascan" > /proc/scsi/qla2300/0    # For Qlogic Fiber card 0
# echo "scsi-qlascan" > /proc/scsi/qla2300/1    # For Qlogic Fiber card 1

Lets force the scsi mid layer to do its own scan and build the device table entry for the new device:
We are adding the LUN 04

# echo "scsi add-single-device 00 00 00 04" > /proc/scsi/scsi
# echo "scsi add-single-device 01 00 00 04" > /proc/scsi/scsi

Let see if the new LUN was Assigned (Visible) by Linux

# cd /proc/scsi/sg
# cat device_hdr devices
host    chan    id      lun     type    opens   qdepth  busy    online
0       0       0       2       0       1       64      0       1
0       0       0       4       0       0       64      0       1
1       0       0       2       0       1       64      0       1
1       0       0       4       0       0       64      0       1
#

In the command “echo “scsi add-single-device HH CC TT LL ” >/proc/scsi/scsi”

The path name should have the following format HHCCTTLL :
HH=Adapter number (HBA#)    CC=Channel ID    TT=SCSI ID   LL=LUN ID OF DEVICE

Qlogic Command Line Interface

Qlogic Command Line Interface

Qlogic have a command line tool called “scli” that really simplify the operation of adding SAN disk on Redhat/Centos/Fedora. It can also be used to obtain Fiber card information and setting.

Download it for Redhat 32 Bits or RedHat 64Bits.
Hope to see you soon !

Categories: Storage