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

也可以参考文章:()。

更改完成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.

Thelpfcandqla2xxxdrivers supportissue_lip. For more information about

the API capabilities supported by each driver in Red Hat Enterprise Linux,

refer toTable 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 toSection 16,

“Adding/Removing a Logical Unit Through rescan-scsi-bus.sh”.

echo "- -

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

This

is the same command described inSection 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.

作者:SEian.G(苦练七十二变,笑对八十一难)

linux 扫描 hba卡磁盘,Linux下更换HBA卡重新扫盘相关推荐

  1. android卡为什么iOS不卡,同内存下苹果不卡,安卓却很卡,原因在这里

    原标题:同内存下苹果不卡,安卓却很卡,原因在这里 对手机稍有了解的人都知道iOS和Android的内存机制不同,两个系统一个是封闭式定位,另一个是开放的,虽说各有好处,但对设备的内存还是有很大影响,这 ...

  2. linux修改文件夹磁盘,linux下修改磁盘卷标

    一开始用e2label忘记是nfts分区了.老是提示错误.可以采用: 卸载分区.修改 /media/下的文件夹. 修改/etc/fstab 文件里的挂载描述. fedora8中的分区不再是挂载到/mn ...

  3. linux top命令看磁盘,linux top命令详解

    linux top命令详解 下面详细介绍它的使用方法. top - 01:06:48 up 1:22, 1 user, load average: 0.06, 0.60, 0.48 Tasks: 29 ...

  4. linux挂载第二块磁盘,linux服务器挂载第二块磁盘图文解说-转自美橙

    Linux磁盘挂载是比较常见的管理操作之一.预装的linux系统有2块盘,一块为系统盘,另外一块磁盘是数据盘,默认没有挂载,需要手动挂载到系统中.具体操作是:需要对磁盘进行格式化,格式化后挂载到需要的 ...

  5. linux扫描文本含有密码,Linux基础命令常用

    允许非root用户使用"sudo" root身份登录系统,执行"visudo",根据示例添加新的一个规则(记住输入的密码是当前用户密码,而不是root密码) # ...

  6. linux centos7如何格式化磁盘,Linux CentOS 7 磁盘格式化mke2fs、mkfs.ext4、磁盘挂载及手动增加swap空间...

    一. 磁盘格式化 查看系统支持的分区类型: cat /etc/filesystems[root@fxq-1 ~]# cat /etc/filesystems xfs ext4 ext3 ext2 no ...

  7. linux查看已挂载磁盘,linux查看与挂载磁盘

    HQY (1) 用命令fdisk -l查看磁盘 (2) 新建一个文件夹,作为将来访问vdb1的标识 mkdir    /data1 (3) 查看磁盘vdb1的文件系统类型 df    -T (4) 挂 ...

  8. kali linux扫描sql注入,Kali Linux系统利用DVWA靶场进测试SQL注入漏洞:

    手工盲注:手工盲注分为基于布尔的盲注.基于时间的盲注以及基于报错的盲注,手工盲注步骤:1.判断是否存在注入,注入是字符型还是数字型;2.猜解当前数据库名;3.猜解数据库中表名;4.猜解表中的字段名;5 ...

  9. linux服务器新装hba卡,Linux更换HBA卡后重新扫盘指令|或者新增HBA卡

    lspci #查看是否有HBA,linux6通过lspci可以查看 首先确认是哪种光纤卡: lspci | grep -i fibre 光纤卡基本上就以下两种: Emulex: lsmod |grep ...

最新文章

  1. java spring scope_如何在Spring中自定义scope的方法示例
  2. html中,纯数字或纯英文的一串字符超出父容器不会折行显示,如何解决?
  3. Android 程序打包
  4. 从零开始学习Kafka
  5. 中职计算机专业选修课程,中职学校计算机专业选修课开设的实践与研究
  6. python3利用smtplib通过qq邮箱发送邮件
  7. easyui是否容易上手_特色家常菜-清蒸桂鱼,肉质鲜嫩有营养,做法简单容易学...
  8. 微信打开页面底部显示“原页面已由QQ浏览器云转码”解决办法
  9. tinymce引入后未显示_讷河华宁电子QJZ1-1600/3300主控制及显示总成101系统用
  10. win10安装Unbuntu的Linux系统的虚拟机
  11. 农行支付php,ECSHOP教程:农行支付接口开发(含手机端)
  12. 2-10 TreeView 控件
  13. 《Web漏洞防护》读书笔记——第10章,反序列化漏洞防护
  14. IBMX3850X5服务器安装2008R2系统
  15. 小米4 android6.01的开发者模式开启方法
  16. 如何在服务器上还原数据库文件,SQL Server 使用入门教程(bak文件还原数据库)...
  17. 基于高德地图实现Marker聚合效果
  18. 阿里云和本地网络安装clone GitHub代码很慢的解决
  19. 关键词生成器在线-在线免费关键词生成器
  20. 【kratos】kratos 框架使用新的,还是非常好的技术框架,还要继续学习,掌握了proto 文件的使用、wire的使用就方便了。

热门文章

  1. 【安全资讯】《网络产品安全漏洞管理规定》出台,漏洞披露者的紧箍咒?
  2. mac电脑打不开应用程序的解决方法
  3. 2005首届中国优秀独立WAP TOP50
  4. 关于笔记本真机装Linux连接WIFI并设置静态IP
  5. 指南针的实现代码两种方法,怎么用
  6. 行人重识别(4)——行人重识别(基于视频)综述
  7. 人的一生会遇上的四个人
  8. 大数据-Hadoop-云服务器的搭建
  9. 中国人寿如何基于容器搭建金融PaaS云平台 1
  10. 批量将文件名称转为大写