主机测评 VPS推荐
专注于真实的VPS测评
ptgidc ptgidc ptgidc

Linux下如何更换HBA卡重新扫盘

ptgidc ptgidc

这篇文章将为大家详细讲解有关Linux下如何更换HBA卡重新扫盘,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。Linux 主机上外接FC 存储时,一般都会在主机上加装HBA 卡,HBA卡通过WWN号连接光纤交换机或直接存储。如果HBA卡出问题需要更换时,WWN号相应的也会改变,中间的这个纽带相当于断了,就无法正常识别存储磁盘分区。当然有些HBA上面贴的有WWN号,可以在更换HBA卡之前在光交或存储上更换相应的配置。不过很多没有标这个,需要到系统下通过命令查看新识别的WWN号。
查看HBA卡WWN号的操作方法如下:
[root@seaing host4]# cat /sys/class/fc_host/host4/node_name 0x200000e08b86fd5c也可以参考文章:linux下查看wwn号(http://www.361way.com/linux-wwwn-hba/4200.html)。更改完成WWN号后,系统无法直接更新挂载的后端存储盘。需要重新扫下盘,可以使用如下方法进行扫盘操作:[root@seaing ~ ]# cd /sys/class/scsi_host/host4/ [root@seaing host4]# echo ‘- – – ‘ > scan 或[root@seaing host4]# echo “1” > /sys/class/fc_host/host4/issue_lip //某些存储或系统没有scan文件,可以通issue_lip文件识别 扫描前的磁盘状态: [root@seaing host4]# fdisk -l Disk /dev/sda: 500.1 GB,
500107862016 bytes255 heads, 63 sectors/track,
60801 cylindersUnits = cylinders of 16065 *
512 = 8225280 bytes Device Boot Start End Blocks开发云主机域名
Id System/dev/sda1 *
1 13 104391
83 Linux/dev/sda2 14 60801
488279610 8e Linux LVMDisk /dev/sdb: 32.2 GB,
32212254720 bytes255 heads, 63 sectors/track,
3916 cylindersUnits = cylinders of 16065 *
512 = 8225280 bytes Device Boot Start End Blocks
Id System/dev/sdb1 *
1 3916 31455238+
8e Linux LVMDisk /dev/sdc: 32.2 GB,
32212254720 bytes255 heads, 63 sectors/track,
3916 cylindersUnits = cylinders of 16065 *
512 = 8225280 bytes Device Boot Start End Blocks
Id System/dev/sdc1 *
1 3916 31455238+
8e Linux LVM扫描后的磁盘状态: [root@seaing host4]# fdisk -l Disk /dev/sda: 500.1 GB,
500107862016 bytes255 heads, 63 sectors/track,
60801 cylindersUnits = cylinders of 16065 *
512 = 8225280 bytes Device Boot Start End Blocks
Id System/dev/sda1 *
1 13 104391
83 Linux/dev/sda2 14 60801
488279610 8e Linux LVMDisk /dev/sdb: 32.2 GB,
32212254720 bytes255 heads, 63 sectors/track,
3916 cylindersUnits = cylinders of 16065 *
512 = 8225280 bytes Device Boot Start End Blocks
Id System/dev/sdb1 *
1 3916 31455238+
8e Linux LVMDisk /dev/sdc: 32.2 GB,
32212254720 bytes255 heads, 63开发云主机域名 sectors/track,
3916 cylindersUnits = cylinders of 16065 *
512 = 8225280 bytes Device Boot Start End Blocks
Id System/dev/sdc1 *
1 3916 31455238+
8e Linux LVMDisk /dev/sdd: 21.4 GB, 21474836480 bytes 64 heads, 32 sectors/track, 20480 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Disk /dev/sdd doesn’t contain a valid partition table Disk /dev/sde: 21.4 GB, 21474836480 bytes 64 heads, 32 sectors/track, 20480 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Disk /dev/sde doesn’t contain a valid partition table 注意: 1、可以在扫描之前先运行fdisk -l 与扫描之后fdisk -l 的结果进行比对。更换成功的话会发现后者查看到的结果比前者多。所以此类操作前,最好将df 、fdisk 、mount、fstab 等和磁盘相关的信息做个备份,扫描完成后,和原始数据做一个比对是最为保险的。 2、记不住上面的扫描指令也没关系
,通过重启主机,可以达到同样的效果。3、扫盘前后,可以通过查看/proc/scsi/scsi 确认存储挂载信息[root@seaing host4]# cat /proc/scsi/scsi Attached devices:Host: scsi0 Channel: 00 Id:
00 Lun: 00 Vendor: ATA Model: WDC WD5003ABYX-1 Rev: 01.0 Type:
Direct-Access
ANSI SCSI revision: 05Host: scsi2 Channel: 00 Id:
00 Lun: 00 Vendor: PLDS Model: DVD-ROM DH-16D6S Rev: BD11 Type:
CD-ROM
ANSI SCSI revision: 05Host: scsi4 Channel: 00 Id: 00 Lun: 00 Vendor: HP Model: HSV300 Rev: 0005 Type: RAID ANSI SCSI
revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 01 Vendor: HP Model: HSV300 Rev: 0005 Type: Direct-Access ANSI SCSI revision: 05 Host: scsi4 Channel: 00 Id: 01 Lun: 00 Vendor: HP Model: HSV300 Rev: 0005 Type: RAID ANSI SCSI
revision: 05
Host: scsi4 Channel: 00 Id: 01 Lun: 01 Vendor: HP Model: HSV300 Rev: 0005 Type: Direct-Access ANSI SCSI revision: 05 Host: scsi4 Channel: 00 Id: 00 Lun: 02 Vendor: HP Model: HSV300 Rev: 0005 Type: Direct-Access ANSI SCSI revision: 05 Host: scsi4 Channel: 00 Id: 01 Lun: 02 Vendor: HP Model: HSV300 Rev: 0005 Type: Direct-Access ANSI SCSI revision: 05 下面是redhat官网给出的存储扫盘说明: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Online_Storage_Reconfiguration_Guide/scanning-storage-interconnects.html ***********************************************************************************************************9 Scanning Storage Interconnects There
are several commands available that allow you to reset and/or scan one or more
interconnects, potentially adding and removing multiple devices in one
operation. This type of scan can be disruptive, as it can cause delays while
I/O operations timeout, and remove devices unexpectedly. As such, Red Hat
recommends that this type of scan be usedonly when necessary. In
addition, the following restrictions must be observed when scanning storage
interconnects:1、All
I/O on the effected interconnects must be paused and flushed before executing
the procedure, and the results of the scan checked before I/O is resumed.2、As
with removing a device, interconnect scanning is not recommended when the
system is under memory pressure. To determine the level of memory pressure, run
the commandvmstat 1 100; interconnect scanning is not recommended if free
memory is less than 5% of the total memory in more than 10 samples per 100. It
is also not recommended if swapping is active (non-zerosiandsocolumns
in thevmstatoutput). The commandfreecan also display the
total memory.The
following commands can be used to scan storage interconnects. echo
“1” > /sys/class/fc_host/host/issue_lip
This
operation performs aLoop Initialization Protocol(LIP) and then
scans the interconnect and causes the SCSI layer to be updated to reflect the
devices currently on the bus. A LIP is, essentially, a bus reset, and will
cause device addition and removal. This procedure is necessary to configure a
new SCSI target on a Fibre Channel interconnect.Bear
in mind thatissue_lipis an asynchronous operation. The command may
complete before the entire scan has completed. You must monitor/var/log/messagesto
determine when it is done.Thelpfcandqla2xxxdrivers supportissue_lip. For more information about
the API capabilities supported by each driver in Red Hat Enterprise Linux,
refer toTable1,
“Fibre-Channel API Capabilities”. /usr/bin/rescan-scsi-bus.sh This
script is included in Red Hat Enterprise Linux 5.4 and all future updates. By
default, this script scans all the SCSI buses on the system, updating the SCSI
layer to reflect new devices on the bus. The script provides additional options
to allow device removal and the issuing of LIPs. For more information about
this script (including known issues), refer toSection16,
“Adding/Removing a Logical Unit Through rescan-scsi-bus.sh”.echo “- –
-” > /sys/class/scsi_host/hosth/scan
This
is the same command described inSection7,
“Adding a Storage Device or Path”to add a storage device or path. In
this case, however, the channel number, SCSI target ID, and LUN values are
replaced by wildcards. Any combination of identifiers and wildcards is allowed,
allowing you to make the command as specific or broad as needed. This procedure
will add LUNs, but not remove them.rmmod
driver-nameormodprobe driver-name
These
commands completely re-initialize the state of all interconnects contr开发云主机域名olled by
the driver. Although this is extreme, it may be appropriate in some situations.
This may be used, for example, to re-start the driver with a different module
parameter value.关于Linux下如何更换HBA卡重新扫盘就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

本文从转载,原作者保留一切权利,若侵权请联系删除。

《Linux下如何更换HBA卡重新扫盘》来自互联网同行内容,若有侵权,请联系我们删除!

未经允许不得转载:主机测评 » Linux下如何更换HBA卡重新扫盘