Scan FC or iSCSİ Disk on Linux, remove and format without reboot if fdisk want reboot it and find out WWN of HBA

Many times i was searching on internet and collect many thing from many page about add a new disk to linux OS after that decide to put everything on one place

After assign the LUN from storage to host , on command line of you server pls type below

echo “- – – ” > /sys/class/scsi_host/*host_number*/scan

You can find out host number under ;

/sys/class/scsi_host

On my servers i can see many hosts there like host0,host1,host2 then don’t need to think twice execute the command with all or I’m not %100 sure but on Redhat6/Centos6 you can find out vi execute command below to get HBA ports

 cat /sys/class/fc_host/host

then with fdisk -l you should find the disk , if you are using MPIO then you should check /dev/mapper/mpath* or /dev/dm-*

When execute fdisk and save the new partition sometimes you can get “You should restart to host to use new partition” , don’t worry execute command below

partprobe

but sometimes only execute this can work, sometimes no , then pls execute below

partprobe /dev/mapper/mpath1

Also sometime you need to remove such assigned partition , to do it pls unmount from OS, unassign from storage and read the last link under related links for short see below

# echo 1 > /sys/block/devName/device/delete
# echo 1 > /sys/block/sdc/device/delete

Extra ….

To find out HBA WWNs pls execute below

[root@kahin1 ~]# cat /sys/class/fc_host/host5/port_name
0x21000024ff03f0b0

Related Links and many thanks to they

http://jreypo.wordpress.com/2010/10/28/how-to-rescan-the-scsi-bus-in-linux/
http://zhigang.org/blog/using-partprobe-to-avoid-reboot-after-re-partition/
http://www.linuxquestions.org/questions/linux-hardware-18/how-to-configure-a-hba-card-and-see-its-wwn-676199/
http://www.cyberciti.biz/tips/vmware-add-a-new-hard-disk-without-rebooting-guest.html

Pls command this article if something missing and not working or you do not find out what you are searching

VM

Posted on 26/07/2012, in Linux and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: