RedHat6 Mount FC Storage to Create LVM

图片[1]-RedHat6 挂载FC存储创建LVM

1.检查HBA卡

[root@tlmytkf02 /]# lspci | grep -i fibre
42:00.0 Fibre Channel: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter (rev 01)
42:00.1 Fibre Channel: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter (rev 01)
43:00.0 Fibre Channel: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter (rev 01)
43:00.1 Fibre Channel: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter (rev 01)
[root@tlmytkf02 /]#

2. 查询 WWN 号

[root@tlmytkf02 /]# ls /sys/class/fc_host/
host10  host7  host8  host9
[root@tlmytkf02 /]# cat /sys/class/fc_host/host10/port_name
0x2100f4e9d45550b9
[root@tlmytkf02 /]# cat /sys/class/fc_host/host8/port_name
0x2100f4e9d45550a9

3. 查看存储资源

##重新扫描磁盘
#echo "- - -" > /sys/class/scsi_host/host10/scan
#echo "- - -" > /sys/class/scsi_host/host8/scan
##查看磁盘
#fdisk -l
#lsblk
#ll /dev/disk/by-id/

4. 安装和配置 multipath 软件

1. 查询是否安装 multipath 软件

[root@tlmytkf02 /]# rpm -qa | grep  multipath*
device-mapper-multipath-libs-0.4.9-106.el6.x86_64
device-mapper-multipath-0.4.9-106.el6.x86_64
[root@tlmytkf02 /]#

如未安装可加载ISO镜像文件并配置YUM源进行安装,安装过程中可使用–nodeps参数强制安装

2.查看并确认设备的 WWID

RedHat 6.X 及之后版本使用如下脚本命令

for i in `cat /proc/partitions | awk {'print $4'} | grep sd`; do echo "Device: $i WWID: `scsi_id --page=0x83 --whitelisted --device=/dev/$i`"; done | sort -k4
[root@tlmytkf02 /]# for i in `cat /proc/partitions | awk {'print $4'} | grep sd`; do echo "Device: $i WWID: `scsi_id --page=0x83 --whitelisted --device=/dev/$i`"; done | sort -k4
Device: sdaq WWID: 3600601600cb03500009a88c5caeaec11
Device: sdar WWID: 3600601600cb03500009a88c5caeaec11
Device: sdas WWID: 3600601600cb03500009a88c5caeaec11
Device: sdat WWID: 3600601600cb03500009a88c5caeaec11
Device: sdaf WWID: 3600601600cb03500845d1c1b8be0ec11
Device: sdao WWID: 3600601600cb03500845d1c1b8be0ec11
Device: sdn WWID: 3600601600cb03500845d1c1b8be0ec11
Device: sdw WWID: 3600601600cb03500845d1c1b8be0ec11
Device: sdag WWID: 3600601600cb03500865d1c1b8be0ec11
Device: sdap WWID: 3600601600cb03500865d1c1b8be0ec11
Device: sdo WWID: 3600601600cb03500865d1c1b8be0ec11
Device: sdx WWID: 3600601600cb03500865d1c1b8be0ec11
Device: sdah WWID: 3600601600cb035009a1b05158be0ec11
Device: sdg WWID: 3600601600cb035009a1b05158be0ec11
Device: sdp WWID: 3600601600cb035009a1b05158be0ec11
Device: sdy WWID: 3600601600cb035009a1b05158be0ec11
Device: sdai WWID: 3600601600cb035009c1b05158be0ec11
Device: sdh WWID: 3600601600cb035009c1b05158be0ec11
Device: sdq WWID: 3600601600cb035009c1b05158be0ec11
Device: sdz WWID: 3600601600cb035009c1b05158be0ec11
Device: sdaa WWID: 3600601600cb035009e1b05158be0ec11
Device: sdaj WWID: 3600601600cb035009e1b05158be0ec11
Device: sdi WWID: 3600601600cb035009e1b05158be0ec11
Device: sdr WWID: 3600601600cb035009e1b05158be0ec11
Device: sdab WWID: 3600601600cb03500a01b05158be0ec11
Device: sdak WWID: 3600601600cb03500a01b05158be0ec11
Device: sdj WWID: 3600601600cb03500a01b05158be0ec11
Device: sds WWID: 3600601600cb03500a01b05158be0ec11
Device: sdac WWID: 3600601600cb03500a21b05158be0ec11
Device: sdal WWID: 3600601600cb03500a21b05158be0ec11
Device: sdk WWID: 3600601600cb03500a21b05158be0ec11
Device: sdt WWID: 3600601600cb03500a21b05158be0ec11
Device: sdad WWID: 3600601600cb03500a41b05158be0ec11
Device: sdam WWID: 3600601600cb03500a41b05158be0ec11
Device: sdl WWID: 3600601600cb03500a41b05158be0ec11
Device: sdu WWID: 3600601600cb03500a41b05158be0ec11
Device: sdae WWID: 3600601600cb03500a61b05158be0ec11
Device: sdan WWID: 3600601600cb03500a61b05158be0ec11
Device: sdm WWID: 3600601600cb03500a61b05158be0ec11
Device: sdv WWID: 3600601600cb03500a61b05158be0ec11
Device: sda1 WWID: 36b0003945c0ade6524d72c12068a0086
Device: sda2 WWID: 36b0003945c0ade6524d72c12068a0086
Device: sda WWID: 36b0003945c0ade6524d72c12068a0086
Device: sdb1 WWID: 36b0003945c0ade6524d72c1e07483753
Device: sdb WWID: 36b0003945c0ade6524d72c1e07483753
[root@tlmytkf02 /]#

判断新增磁盘及黑名单磁盘(通常是本地磁盘及第三方磁盘) , 以上文中输出的结果为
例, 36b0003945c0ade6524d72c12068a0086/36b0003945c0ade6524d72c1e07483753 为本地磁盘, 需要放在黑名单中;具有相同WWID的磁盘, 为同一个多路径设备的子设备。

3.配置多路径配置文件

blacklist {
#黑名单设备列表
    wwid 36b0003945c0ade6524d72c12068a0086
    wwid 36b0003945c0ade6524d72c1e07483753
}
defaults {
    user_friendly_names         yes
    polling_interval            10
    checker_timeout             120
    queue_without_daemon        no
    flush_on_last_del           yes
}
devices {
        device {
        vendor                "EMC"
        product               "VNX5500"
        path_grouping_policy  group_by_prio
        no_path_retry         30
        prio                  alua
        getuid_callout        "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
        path_checker          tur
        path_selector         "round-robin 0"
        hardware_handler      "0"
        failback              15
                }
}
multipaths {
        multipath {
                wwid 3600601600cb035009e1b05158be0ec11
                alias mpatha
    } 
        multipath {
                wwid 3600601600cb03500a01b05158be0ec11
                alias mpathb
    } 
        multipath {
                wwid 3600601600cb03500a21b05158be0ec11
                alias mpathc
    }
        multipath {
                wwid 3600601600cb03500a41b05158be0ec11
                alias mpathd
    }
        multipath {
                wwid 3600601600cb03500a61b05158be0ec11
                alias mpathe
    }
        multipath {
                wwid 3600601600cb03500845d1c1b8be0ec11
                alias mpathf
    }
        multipath {
                wwid 3600601600cb03500865d1c1b8be0ec11
                alias mpathg
    }
        multipath {
                wwid 3600601600cb035009a1b05158be0ec11
                alias mpathh
    }
        multipath {
                wwid 3600601600cb035009c1b05158be0ec11
                alias mpathi
    }
        multipath {
                wwid 3600601600cb03500009a88c5caeaec11
                alias mpathj
    } 
#如有多个多路径设备, 可以逐一添加 multipath { }, 注意{前存在空格。
}

说明:
其中:
user_friendly_names:显示存储设备厂商
polling_interval:路径监测间隔时间,全局参数,对每条路径都有效
checker_timeout: 超时检查
vendor: LUN 的制造商
product:产品的 ID
path_grouping_policy:选择路径的方式【默认是 failover,,各设备厂商默认策略不同,主流的在用 group_by_prio】
path_selector:路径的工作方式
path_checker:检查路径的方式
no_path_retry:路径丢失时,一直等待直到路径恢复
prio:获取路径的优先级
getuid_callout:获取 LUN 的 scsi_id
hardware_handler: 1 表示 emc 的 LUN
failback:路径切换的时间(秒)
queue_without_daemon 及 flush_on_last_del: 解决关于 Linux 服务器对存储端的
Lun 创建 PV 后, 设备不能成功重启/关机, 或 Linux 系统下强制取消 FC 关联 Lun 后, 服
务器不能成功重启/关机的问题。
更多配置属性介绍请参考红帽企业版 LINUX 6 设备映射多路径(DM Multipath)配置及管理中4.3/4.4章节

4. 使用多路径设备

加载 dm-multipath 模块
#modprobe dm-multipath
重启 multipath 服务
#/etc/init.d/multipathd restart
查看多路径状态

# multipath -ll
mpathe (3600601600cb03500a61b05158be0ec11) dm-7 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 10:0:0:7  sdm  8:192  active ready running
| `- 10:0:1:7  sdae 65:224 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 8:0:0:7   sdv  65:80  active ready running
  `- 8:0:1:7   sdan 66:112 active ready running
mpathd (3600601600cb03500a41b05158be0ec11) dm-12 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 8:0:0:6   sdu  65:64  active ready running
| `- 8:0:1:6   sdam 66:96  active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 10:0:0:6  sdl  8:176  active ready running
  `- 10:0:1:6  sdad 65:208 active ready running
mpathc (3600601600cb03500a21b05158be0ec11) dm-3 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 10:0:0:5  sdk  8:160  active ready running
| `- 10:0:1:5  sdac 65:192 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 8:0:0:5   sdt  65:48  active ready running
  `- 8:0:1:5   sdal 66:80  active ready running
mpathb (3600601600cb03500a01b05158be0ec11) dm-6 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 8:0:0:4   sds  65:32  active ready running
| `- 8:0:1:4   sdak 66:64  active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 10:0:0:4  sdj  8:144  active ready running
  `- 10:0:1:4  sdab 65:176 active ready running
mpatha (3600601600cb035009e1b05158be0ec11) dm-5 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 10:0:0:3  sdi  8:128  active ready running
| `- 10:0:1:3  sdaa 65:160 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 8:0:0:3   sdr  65:16  active ready running
  `- 8:0:1:3   sdaj 66:48  active ready running
mpathj (3600601600cb03500009a88c5caeaec11) dm-11 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 8:0:0:10  sdas 66:192 active ready running
| `- 8:0:1:10  sdat 66:208 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 10:0:0:10 sdaq 66:160 active ready running
  `- 10:0:1:10 sdar 66:176 active ready running
mpathi (3600601600cb035009c1b05158be0ec11) dm-4 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 8:0:0:2   sdq  65:0   active ready running
| `- 8:0:1:2   sdai 66:32  active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 10:0:0:2  sdh  8:112  active ready running
  `- 10:0:1:2  sdz  65:144 active ready running
mpathh (3600601600cb035009a1b05158be0ec11) dm-10 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 10:0:0:1  sdg  8:96   active ready running
| `- 10:0:1:1  sdy  65:128 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 8:0:0:1   sdp  8:240  active ready running
  `- 8:0:1:1   sdah 66:16  active ready running
mpathg (3600601600cb03500865d1c1b8be0ec11) dm-9 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 10:0:0:9  sdo  8:224  active ready running
| `- 10:0:1:9  sdag 66:0   active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 8:0:0:9   sdx  65:112 active ready running
  `- 8:0:1:9   sdap 66:144 active ready running
mpathf (3600601600cb03500845d1c1b8be0ec11) dm-8 DGC,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 8:0:0:8   sdw  65:96  active ready running
| `- 8:0:1:8   sdao 66:128 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 10:0:0:8  sdn  8:208  active ready running
  `- 10:0:1:8  sdaf 65:240 active ready running
[root@tlmytkf02 /]#

相关说明:
a) 10:0:1:8 为设备地址,数字分别对应:Host:Bus:Target:Lun
b) dm-12 设备有两个 path group,每个 PG 都有2条路径,状态 active 的是正在工作的路径,状态 enabled 处于备用状态,并不下发 IO

5. 创建和挂载文件系统

1. 创建PV

#pvcreate /dev/mapper/mpatha
......
#pvcreate /dev/mapper/mpathj

查看pv:pvdisplay

2. 创建VG

#vgcreate oracle_vg /dev/mapper/mpatha

将其余pv加入vg:

#vgextend oracle_vg /dev/mapper/mpathb
......
#vgextend oracle_vg /dev/mapper/mpathj

查看vg:vgdisplay
修改vg名称:通过vgs -v名称查看vg的uuid,然后通过命令vgrename vguuid newvgname来修改。

3.创建LV

#lvcreate -n oracle_lv -L 9.99t oracle_vg
其中-L是指定大小,-n是指定名称
查看lv:lvdisplay

4.格式化分区

#mkfs.ext4 /dev/oracle_vg/oracle_lv

5.挂载文件系统

#mount /dev/oracle_vg/oracle_lv /mnt
© Copyright Notice
THE END
If you like it, please support it.
like129Appreciate Share
Comment 共2条
avatar
Welcome to leave valuable insights!
submit
avatar

Nick name

Cancel
Nick nameexpressioncodepicture
    • avatarMark0