重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

Linux下如何更换HBA卡重新扫盘-创新互联

这篇文章将为大家详细讲解有关Linux下如何更换HBA卡重新扫盘,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

十载的茶陵网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。全网营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整茶陵建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“茶陵网站设计”,“茶陵网站推广”以来,每个客户项目都认真落实执行。

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 bytes

255 heads, 63 sectors/track, 60801 cylinders

Units = 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 LVM

Disk /dev/sdb: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1        3916    31455238+  8e  Linux LVM

Disk /dev/sdc: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 cylinders

Units = 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 bytes

255 heads, 63 sectors/track, 60801 cylinders

Units = 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 LVM

Disk /dev/sdb: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1        3916    31455238+  8e  Linux LVM

Disk /dev/sdc: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1   *           1        3916    31455238+  8e  Linux LVM

Disk /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: 05

Host: scsi2 Channel: 00 Id: 00 Lun: 00

  Vendor: PLDS     Model: DVD-ROM DH-16D6S Rev: BD11

  Type:   CD-ROM                           ANSI SCSI revision: 05

Host: 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 used only 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 command vmstat 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-zero si and so columns in the vmstat output). The command free can 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 a Loop 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 that issue_lip is an asynchronous operation. The command may complete before the entire scan has completed. You must monitor /var/log/messages to determine when it is done.

The lpfc and qla2xxx drivers support issue_lip. For more information about the API capabilities supported by each driver in Red Hat Enterprise Linux, refer to Table 1, “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 to Section 16, “Adding/Removing a Logical Unit Through rescan-scsi-bus.sh”.

echo "- - -" > /sys/class/scsi_host/hosth/scan

This is the same command described in Section 7, “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-name or modprobe driver-name

These commands completely re-initialize the state of all interconnects controlled 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卡重新扫盘-创新互联
当前地址:http://cqcxhl.com/article/dsggjj.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP