溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Linux下如何更換HBA卡重新掃盤

發(fā)布時間:2021-11-06 16:00:15 來源:億速云 閱讀:325 作者:柒染 欄目:建站服務器

這篇文章將為大家詳細講解有關(guān)Linux下如何更換HBA卡重新掃盤,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。

Linux 主機上外接FC 存儲時,一般都會在主機上加裝HBA 卡,HBA卡通過WWN號連接光纖交換機或直接存儲。如果HBA卡出問題需要更換時,WWN號相應的也會改變,中間的這個紐帶相當于斷了,就無法正常識別存儲磁盤分區(qū)。當然有些HBA上面貼的有WWN號,可以在更換HBA卡之前在光交或存儲上更換相應的配置。不過很多沒有標這個,需要到系統(tǒng)下通過命令查看新識別的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號后,系統(tǒng)無法直接更新掛載的后端存儲盤。需要重新掃下盤,可以使用如下方法進行掃盤操作:

[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  

//某些存儲或系統(tǒng)沒有scan文件,可以通issue_lip文件識別

掃描前的磁盤狀態(tài):

[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

掃描后的磁盤狀態(tài):

[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 的結(jié)果進行比對。更換成功的話會發(fā)現(xiàn)后者查看到的結(jié)果比前者多。所以此類操作前,最好將df 、fdisk 、mount、fstab 等和磁盤相關(guān)的信息做個備份,掃描完成后,和原始數(shù)據(jù)做一個比對是最為保險的。

2、記不住上面的掃描指令也沒關(guān)系 ,通過重啟主機,可以達到同樣的效果。

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官網(wǎng)給出的存儲掃盤說明:

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.

關(guān)于Linux下如何更換HBA卡重新掃盤就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI