RedHat6 挂载FC存储创建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 /]#

相关释义:

原文链接

输出可以被分成三个部分。每个部分都显示以下组的信息:

多路径设备信息:

mpatha (3600d0230000000000e13954ed5f89300): 别名 (如果与别名不同,则为 wwid)
dm-4: dm 设备名称
WINSYS,SF2372: 供应商,产品
size=233G: 大小
features='1 queue_if_no_path': 功能
hwhandler='0': 硬件处理器
wp=rw: 写权限
路径组信息:

policy='service-time 0': 调度策略
prio=1 :路径组优先级
status=active: 路径组状态
路径信息:

6:0:0:0: host:channel:id:lun

sdf: devnode

8:80: major:minor 号

active: dm status

ready :路径状态

running :在线状态

有关 dm、路径和在线状态的更多信息,请参阅 路径状态。

用于列出、创建或重新载入多路径设备的其他多路径命令也会显示设备拓扑。但是,某些信息可能未知,并在输出中显示为 undef。这是正常的行为。使用 multipath -ll 命令查看正确的状态。

注意:

在某些情况下,如创建多路径设备,多路径拓扑会显示一个参数,这代表是否采取了任何操作。例如,以下命令输出显示create: 参数,来表示创建了一个多路径设备:

create: mpatha (3600d0230000000000e13954ed5f89300) undef WINSYS,SF2372
size=233G features='1 queue_if_no_path' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
`- 6:0:0:0 sdf 8:80 undef ready running

路径状态
multipathd 守护进程会根据 /etc/multipath.conf 文件中定义的轮询间隔定期对路径状态进行更新。就内核而言,dm 状态与路径状态类似。dm 状态将保留其当前状态,直到路径检查程序完成为止。

路径状态

ready, ghost该路径已启动并准备好进行 I/O。

faulty, shaky路径为停用。

i/o pending检查程序正积极检查此路径,状态将很快更新。

i/o timeout检查程序在超时之前没有返回success/failure。这被认为与 faulty 一样。

removed该路径已从系统中删除,很快也将从多路径设备中删除。这被认为与 faulty 一样。

wild multipathd 无法运行路径检查程序,因为内部错误或配置问题。这与 faulty 相同,除了多路径会跳过路径上的许多操作。

unchecked路径检查程序还没有在此路径上运行,要么是因为它刚刚被发现,还没有一个分配的路径检查程序,要么是路径检查程序遇到了错误。这与 wild 相同。

delayed路径检查程序返回路径已启动,但多路径会延迟路径的恢复,因为路径最近失败了多次,且多路径已被配置为在此种情况下延迟路径。这被认为与 faulty 一样。

DM 状态

Active映射到 ready 和 ghost 路径状态。

Failed映射到所有其他路径的状态,除了 没有等效的 dm 状态的 i/o pending 。

在线状态

Running设备已启用。

Offline设备已禁用。

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
© Заявление об авторском праве
THE END
Поддерживай, если хочешь.
Похвалить129Высокая оценка Поделиться
Соответствующие рекомендации
Замечания 共2条
头像
Добро пожаловать, чтобы оставить ценные идеи!
提交
头像

Прозвище

取消
ПрозвищеЛицоКодФотографии