linux存储设备识别fc模式

1. 环境

存储使用fc模式链接到服务器:服务器【QLE2692光纤卡】--光纤交换机【已划zone】--存储【已映射】

多路径软件:multipath

yum install device-mapper-multipath

/sbin/mpathconf --enable

systemctl start multipathd

 

 

SCSI磁盘路径在Linux上有3中表现方式:一、/dev/sd目录;二、通过major:minor号;三、/dev/disk/by-path,该目录是 /dev/sd设备的软连接。

 

2. fc扫描

rescan-scsi-bus.sh

验证

multipath -ll

 

注:若未配置多路径的话,可使用以下命令直接查看
lsblk
lsscsi

 

若扫描失败

 

使用下面命令在系统上重新扫描磁盘设备。

echo "- - -" > /sys/class/scsi_host/host2/scan
echo "- - -" > /sys/class/scsi_host/host8/scan

添加设备扫描

echo "scsi add-single-device 0 0 0 0" > /proc/scsi/scsi

Linux操作系统提供多种存储链路重置操作。存储链路重置通常用于多路径设备添加或者删除,这是一种破坏性操作,将导致IO操作超时。请谨慎使用这类型操作。

issue_lip重置HBA链路,会重新扫描整个链路并配置SCSI target。

echo 1> /sys/class/fc_host/host8/issue_lip
echo 1> /sys/class/fc_host/host2/issue_lip
rescan-scsi-bus.sh

 若无法识别,尝试清理缓存

echo 3 > /proc/sys/vm/drop_caches

 

存储删除

1).  查看本地盘

[root@santiagod ~]# lsblk
NAME               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                  8:0    0 223.1G  0 disk  
├─sda1               8:1    0     1G  0 part  /boot
├─sda2               8:2    0   600M  0 part  /boot/efi
└─sda3               8:3    0 221.5G  0 part  
  ├─santiagod-root 253:0    0 209.7G  0 lvm   /
  └─santiagod-swap 253:1    0  11.8G  0 lvm   [SWAP]
sdb                  8:16   0   7.3T  0 disk  
sdc                  8:32   0   200G  0 disk  
└─mpathd           253:2    0   200G  0 mpath 
sdd                  8:48   0   200G  0 disk  
└─mpathd           253:2    0   200G  0 mpath 
sde                  8:64   0   200G  0 disk  
└─mpathd           253:2    0   200G  0 mpath 
sdf                  8:80   0   200G  0 disk  
└─mpathd           253:2    0   200G  0 mpath 
[root@santiagod ~]# ls /sys/class/block/
dm-0  dm-1  dm-2  sda  sda1  sda2  sda3  sdb  sdc  sdd  sde  sdf
[root@santiagod ~]# ls /sys/block/
dm-0  dm-1  dm-2  sda  sdb  sdc  sdd  sde  sdf

 

[root@santiagod ~]# lsscsi -i
[0:0:8:0]    enclosu LSI      SAS2X28          0e12  -          -
[0:2:0:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sda   3600605b0091c12d0187605863f5b4c13
[0:2:1:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sdb   3600605b0091c12d0187612677195c779
[3:0:0:0]    disk    IFT      GS 3000 Series   162G  /dev/sde   3600d023100075deb259bc3e66d760193
[3:0:0:1]    enclosu IFT      GS 3000 Series   162G  -          -
[3:0:1:0]    disk    IFT      GS 3000 Series   162G  /dev/sdf   3600d023100075deb259bc3e66d760193
[3:0:1:1]    enclosu IFT      GS 3000 Series   162G  -          -
[8:0:0:0]    disk    IFT      GS 3000 Series   162G  /dev/sdd   3600d023100075deb259bc3e66d760193
[8:0:0:1]    enclosu IFT      GS 3000 Series   162G  -          -
[8:0:1:0]    disk    IFT      GS 3000 Series   162G  /dev/sdc   3600d023100075deb259bc3e66d760193
[8:0:1:1]    enclosu IFT      GS 3000 Series   162G  -          -
[root@santiagod ~]# lsscsi -g
[0:0:8:0]    enclosu LSI      SAS2X28          0e12  -          /dev/sg0 
[0:2:0:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sda   /dev/sg1 
[0:2:1:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sdb   /dev/sg2 
[3:0:0:0]    disk    IFT      GS 3000 Series   162G  /dev/sde   /dev/sg7 
[3:0:0:1]    enclosu IFT      GS 3000 Series   162G  -          /dev/sg8 
[3:0:1:0]    disk    IFT      GS 3000 Series   162G  /dev/sdf   /dev/sg9 
[3:0:1:1]    enclosu IFT      GS 3000 Series   162G  -          /dev/sg10
[8:0:0:0]    disk    IFT      GS 3000 Series   162G  /dev/sdd   /dev/sg5 
[8:0:0:1]    enclosu IFT      GS 3000 Series   162G  -          /dev/sg6 
[8:0:1:0]    disk    IFT      GS 3000 Series   162G  /dev/sdc   /dev/sg3 
[8:0:1:1]    enclosu IFT      GS 3000 Series   162G  -          /dev/sg4 
[root@santiagod ~]# ls /sys/class/scsi_
scsi_device/  scsi_disk/    scsi_generic/ scsi_host/    
[root@santiagod ~]# ls /sys/class/scsi_device/
0:0:8:0  0:2:0:0  0:2:1:0  3:0:0:0  3:0:0:1  3:0:1:0  3:0:1:1  8:0:0:0  8:0:0:1  8:0:1:0  8:0:1:1
[root@santiagod ~]# ls /sys/class/scsi_disk/
0:2:0:0  0:2:1:0  3:0:0:0  3:0:1:0  8:0:0:0  8:0:1:0
[root@santiagod ~]# ls /sys/class/scsi_generic/
sg0  sg1  sg10  sg2  sg3  sg4  sg5  sg6  sg7  sg8  sg9
[root@santiagod ~]# ls /sys/class/scsi_host/
host0  host1  host2  host3  host4  host5  host6  host7  host8

 

存储删除之block

[root@santiagod ~]# echo 1 > /sys/block/
dm-0/ dm-1/ dm-2/ sda/  sdb/  sdc/  sdd/  sde/  sdf/  
[root@santiagod ~]# echo 1 > /sys/block/sdc/device/delete 
[root@santiagod ~]# for i in sd{c,d,e,f};do echo 1 > /sys/block/${i}/device/delete;done
[root@santiagod ~]# lsblk
NAME               MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                  8:0    0 223.1G  0 disk 
├─sda1               8:1    0     1G  0 part /boot
├─sda2               8:2    0   600M  0 part /boot/efi
└─sda3               8:3    0 221.5G  0 part 
  ├─santiagod-root 253:0    0 209.7G  0 lvm  /
  └─santiagod-swap 253:1    0  11.8G  0 lvm  [SWAP]
sdb                  8:16   0   7.3T  0 disk 
[root@santiagod ~]# lsscsi -i
[0:0:8:0]    enclosu LSI      SAS2X28          0e12  -          -
[0:2:0:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sda   3600605b0091c12d0187605863f5b4c13
[0:2:1:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sdb   3600605b0091c12d0187612677195c779
[3:0:0:1]    enclosu IFT      GS 3000 Series   162G  -          -
[3:0:1:1]    enclosu IFT      GS 3000 Series   162G  -          -
[8:0:0:1]    enclosu IFT      GS 3000 Series   162G  -          -
[8:0:1:1]    enclosu IFT      GS 3000 Series   162G  -          -
[root@santiagod ~]# lsscsi -g
[0:0:8:0]    enclosu LSI      SAS2X28          0e12  -          /dev/sg0 
[0:2:0:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sda   /dev/sg1 
[0:2:1:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sdb   /dev/sg2 
[3:0:0:1]    enclosu IFT      GS 3000 Series   162G  -          /dev/sg8 
[3:0:1:1]    enclosu IFT      GS 3000 Series   162G  -          /dev/sg10
[8:0:0:1]    enclosu IFT      GS 3000 Series   162G  -          /dev/sg6 
[8:0:1:1]    enclosu IFT      GS 3000 Series   162G  -          /dev/sg4 

存储删除之scsi

for i in sg{4..10..2};do echo 1 > /sys/class/scsi_generic/$i/device/delete ;done
[root@santiagod ~]# lsscsi
[0:0:8:0]    enclosu LSI      SAS2X28          0e12  -        
[0:2:0:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sda 
[0:2:1:0]    disk    LSI      MR9280-4i4e      2.13  /dev/sdb 

 

遇到问题:缓存信息残留,已解决

[root@santiagod ~]# lsblk 
NAME               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                  8:0    0 223.1G  0 disk  
├─sda1               8:1    0     1G  0 part  /boot
├─sda2               8:2    0   600M  0 part  /boot/efi
└─sda3               8:3    0 221.5G  0 part  
  ├─santiagod-root 253:0    0 209.7G  0 lvm   /
  └─santiagod-swap 253:1    0  11.8G  0 lvm   [SWAP]
sdb                  8:16   0   7.3T  0 disk  
mpathe             253:2    0   500G  0 mpath 

[root@santiagod ~]# dmsetup ls
mpathe    (253:2)
santiagod-swap    (253:1)
santiagod-root    (253:0)
[root@santiagod ~]# dmsetup remove mpathe
[root@santiagod ~]# dmsetup ls
santiagod-swap    (253:1)
santiagod-root    (253:0)
[root@santiagod ~]# lsblk 
NAME               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                  8:0    0 223.1G  0 disk  
├─sda1               8:1    0     1G  0 part  /boot
├─sda2               8:2    0   600M  0 part  /boot/efi
└─sda3               8:3    0 221.5G  0 part  
  ├─santiagod-root 253:0    0 209.7G  0 lvm   /
  └─santiagod-swap 253:1    0  11.8G  0 lvm   [SWAP]
sdb                  8:16   0   7.3T  0 disk  

 

posted @ 2022-12-30 14:02  咿呀哒喏  阅读(1463)  评论(0编辑  收藏  举报