|
背景:项目中,92-98物理机采用的是华三的3par集中式网络存储,每台机器挂载有一个2TB的硬盘,由于使用的多路径,所以展示出来的结果就是多个盘。
多路径:多条链路提供存储,一条链路出现问题,不影响磁盘使用。
挂载方法:
1、安装插件
- yum install -y device-mapper-multipath
复制代码 2、新建 /etc/multipath.conf 文件
- # This is a basic configuration file with some examples, for device mapper
- # multipath.
- #
- # For a complete list of the default configuration values, run either
- # multipath -t
- # or
- # multipathd show config
- #
- # For a list of configuration options with descriptions, see the multipath.conf
- # man page
- ## By default, devices with vendor = "IBM" and product = "S/390.*" are
- ## blacklisted. To enable mulitpathing on these devies, uncomment the
- ## following lines.
- #blacklist_exceptions {
- # device {
- # vendor "IBM"
- # product "S/390.*"
- # }
- #}
- ## Use user friendly names, instead of using WWIDs as names.
- #defaults {
- # user_friendly_names yes
- # find_multipaths yes
- #}
- ##
- ## Here is an example of how to configure some standard options.
- ##
- #
- #defaults {
- # polling_interval 10
- # path_selector "round-robin 0"
- # path_grouping_policy multibus
- # uid_attribute ID_SERIAL
- # prio alua
- # path_checker readsector0
- # rr_min_io 100
- # max_fds 8192
- # rr_weight priorities
- # failback immediate
- # no_path_retry fail
- # user_friendly_names yes
- #}
- ##
- ## The wwid line in the following blacklist section is shown as an example
- ## of how to blacklist devices by wwid. The 2 devnode lines are the
- ## compiled in default blacklist. If you want to blacklist entire types
- ## of devices, such as all scsi devices, you should use a devnode line.
- ## However, if you want to blacklist specific devices, you should use
- ## a wwid line. Since there is no guarantee that a specific device will
- ## not change names on reboot (from /dev/sda to /dev/sdb for example)
- ## devnode lines are not recommended for blacklisting specific devices.
- ##
- #blacklist {
- # wwid 26353900f02796769
- # devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
- # devnode "^hd[a-z]"
- #}
- #multipaths {
- # multipath {
- # wwid 3600508b4000156d700012000000b0000
- # alias yellow
- # path_grouping_policy multibus
- # path_selector "round-robin 0"
- # failback manual
- # rr_weight priorities
- # no_path_retry 5
- # }
- # multipath {
- # wwid 1DEC_____321816758474
- # alias red
- # }
- #}
- #devices {
- # device {
- # vendor "COMPAQ "
- # product "HSV110 (C)COMPAQ"
- # path_grouping_policy multibus
- # path_checker readsector0
- # path_selector "round-robin 0"
- # hardware_handler "0"
- # failback 15
- # rr_weight priorities
- # no_path_retry queue
- # }
- # device {
- # vendor "COMPAQ "
- # product "MSA1000 "
- # path_grouping_policy multibus
- # }
- #}
- blacklist {
- }
- defaults {
- polling_interval 10
- user_friendly_names no
- find_multipaths yes
- }
- devices {
- device {
- vendor "3PARdata"
- product "VV"
- path_grouping_policy group_by_prio
- path_selector "round-robin 0"
- path_checker tur
- features "0"
- hardware_handler "1 alua"
- prio alua
- failback immediate
- rr_weight uniform
- no_path_retry 18
- rr_min_io_rq 1
- detect_prio yes
- }
- }
- multipaths {
- multipath {
- wwid 360002ac00000000000000020000209e9
- alias oradata
- }
- multipath {
- wwid 360002ac00000000000000025000209e9
- alias management1
- }
- multipath {
- wwid 360002ac00000000000000026000209e9
- alias management2
- }
- multipath {
- wwid 360002ac00000000000000027000209e9
- alias votting1
- }
- multipath {
- wwid 360002ac00000000000000028000209e9
- alias votting2
- }
- }
复制代码 3、验证生成wwn文件,查看磁盘id
- ll /dev/disk/by-id
- total 0
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 dm-name-cl-swap -> ../../dm-0
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 dm-uuid-LVM-w8tBZQeobwqkqq2whhl3jqYpUh2s2zh8rx2rTOpjORXiwW43hqWhD4tgaVgb0T7d -> ../../dm-0
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 lvm-pv-uuid-2Ka8iQ-ZlMi-a1Ae-13kD-qI6U-xDZ3-rFgR5g -> ../../sda4
- lrwxrwxrwx 1 root root 9 Mar 15 19:18 scsi-360002ac0000000000000daf300025d53 -> ../../sdi
- lrwxrwxrwx 1 root root 9 Mar 15 19:18 scsi-3600605b0110ca9b029c31a1eed563978 -> ../../sda
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 scsi-3600605b0110ca9b029c31a1eed563978-part1 -> ../../sda1
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 scsi-3600605b0110ca9b029c31a1eed563978-part2 -> ../../sda2
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 scsi-3600605b0110ca9b029c31a1eed563978-part3 -> ../../sda3
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 scsi-3600605b0110ca9b029c31a1eed563978-part4 -> ../../sda4
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 scsi-3600605b0110ca9b029c31a1eed563978-part5 -> ../../sda5
- lrwxrwxrwx 1 root root 9 Mar 15 19:18 wwn-0x60002ac0000000000000daf300025d53 -> ../../sdf
- lrwxrwxrwx 1 root root 9 Mar 15 19:18 wwn-0x600605b0110ca9b029c31a1eed563978 -> ../../sda
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 wwn-0x600605b0110ca9b029c31a1eed563978-part1 -> ../../sda1
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 wwn-0x600605b0110ca9b029c31a1eed563978-part2 -> ../../sda2
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 wwn-0x600605b0110ca9b029c31a1eed563978-part3 -> ../../sda3
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 wwn-0x600605b0110ca9b029c31a1eed563978-part4 -> ../../sda4
- lrwxrwxrwx 1 root root 10 Mar 15 19:18 wwn-0x600605b0110ca9b029c31a1eed563978-part5 -> ../../sda5
复制代码 4、查看是否存在两组随机字符串
- cat /sys/class/fc_host/host*/port_name
- 0x210034800d3f3a05
- 0x210034800d3f3d58
复制代码 5、查看磁盘的id
- multipath -l
- baidu_data1 (360002ac0000000000000daf300025d53) dm-1 3PARdata,VV
- size=2.1T features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
- `-+- policy='round-robin 0' prio=0 status=active
- |- 2:0:0:0 sdb 8:16 active undef running
- |- 16:0:0:0 sdf 8:80 active undef running
- |- 2:0:1:0 sdc 8:32 active undef running
- |- 16:0:1:0 sdg 8:96 active undef running
- |- 2:0:2:0 sdd 8:48 active undef running
- |- 16:0:2:0 sdh 8:112 active undef running
- |- 2:0:7:0 sde 8:64 active undef running
- `- 16:0:7:0 sdi 8:128 active undef running
复制代码 6、把第5步看到的id号替换掉 /etc/multipath.conf文件中以下行
- multipaths {
- multipath {
- wwid 360002ac00000000000000020000209e9 #磁盘id
- alias oradata #可以随边取名
- }
复制代码 7、启动服务
- systemctl restart multipathd.service
- systemctl status multipathd.service
复制代码 8、查看磁盘信息
- lsblk
- NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
- sdd 8:48 0 2.1T 0 disk
- └─h3c_jzcc 253:2 0 2.1T 0 mpath
- sdb 8:16 0 2.1T 0 disk
- └─h3c_jzcc 253:2 0 2.1T 0 mpath
- sde 8:64 0 2.1T 0 disk
- └─h3c_jzcc 253:2 0 2.1T 0 mpath
- sdc 8:32 0 2.1T 0 disk
- └─h3c_jzcc 253:2 0 2.1T 0 mpath
- sda 8:0 0 278.9G 0 disk
- ├─sda2 8:2 0 1G 0 part /boot
- ├─sda3 8:3 0 277.7G 0 part
- │ ├─centos-swap 253:1 0 4G 0 lvm
- │ ├─centos-root 253:0 0 80G 0 lvm /
- │ └─centos-home 253:5 0 193.7G 0 lvm /home
- └─sda1 8:1 0 200M 0 part /boot/efi
复制代码 9、进行分区,记得必须要分两个区
- fdisk /dev/mapper/h3c_jzcc
- Welcome to fdisk (util-linux 2.23.2).
- Changes will remain in memory only, until you decide to write them.
- Be careful before using the write command.
- Device does not contain a recognized partition table
- Building a new DOS disklabel with disk identifier 0x1a464a06.
- WARNING: The size of this disk is 2.3 TB (2308544921600 bytes).
- DOS partition table format can not be used on drives for volumes
- larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
- partition table format (GPT).
- Command (m for help): n
- Partition type:
- p primary (0 primary, 0 extended, 4 free)
- e extended
- Select (default p):
- Using default response p
- Partition number (1-4, default 1):
- First sector (32768-4294967295, default 32768):
- Using default value 32768
- Last sector, +sectors or +size{K,M,G} (32768-4294967294, default 4294967294):
- Using default value 4294967294
- Partition 1 of type Linux and of size 2 TiB is set
- Command (m for help): w
- The partition table has been altered!
- Calling ioctl() to re-read partition table.
- WARNING: Re-reading the partition table failed with error 22: Invalid argument.
- The kernel still uses the old table. The new table will be used at
- the next reboot or after you run partprobe(8) or kpartx(8)
- Syncing disks.
复制代码 10、挂载
- lsblk -f
- NAME FSTYPE LABEL UUID MOUNTPOINT
- sdd mpath_member db8cf5b2-c1c0-4192-9cd7-0d26a1e32bca
- └─h3c_jzcc ext4 db8cf5b2-c1c0-4192-9cd7-0d26a1e32bca
- ├─h3c_jzcc2
- └─h3c_jzcc1 ext4 bfcf1ea9-6f70-4715-abab-73feb6a9077f /data
- sdb mpath_member db8cf5b2-c1c0-4192-9cd7-0d26a1e32bca
- └─h3c_jzcc ext4 db8cf5b2-c1c0-4192-9cd7-0d26a1e32bca
- ├─h3c_jzcc2
- └─h3c_jzcc1 ext4 bfcf1ea9-6f70-4715-abab-73feb6a9077f /data
- sde mpath_member db8cf5b2-c1c0-4192-9cd7-0d26a1e32bca
- └─h3c_jzcc ext4 db8cf5b2-c1c0-4192-9cd7-0d26a1e32bca
- ├─h3c_jzcc2
- └─h3c_jzcc1 ext4 bfcf1ea9-6f70-4715-abab-73feb6a9077f /data
- sdc mpath_member db8cf5b2-c1c0-4192-9cd7-0d26a1e32bca
- └─h3c_jzcc ext4 db8cf5b2-c1c0-4192-9cd7-0d26a1e32bca
- ├─h3c_jzcc2
- └─h3c_jzcc1 ext4 bfcf1ea9-6f70-4715-abab-73feb6a9077f /data
- sda
- ├─sda2 ext4 8cc8c9c5-c80f-4144-bd83-dd5b833c0382 /boot
- ├─sda3 LVM2_member JKVITB-A0aV-rXVS-q0vO-YlW3-Kvel-Fw1GNP
- │ ├─centos-swap swap 297cfdff-eb63-4193-a460-575e98d74075
- │ ├─centos-root ext4 841d4192-5fba-4ad7-81ca-aaa0b7181e95 /
- │ └─centos-home ext4 5c7b9ba4-5cde-4c1c-b5ae-8a4550c16cc2 /home
- └─sda1 vfat 4266-FFA9 /boot/efi
- ## 写入
- partprobe /dev/mapper/h3c_jzcc1
- ##格式化分区
- mkfs.ext4 /dev/mapper/h3c_jzcc1
- ## 创建挂载点
- mkdir /data
- ## 写入启动挂载文件
- echo "UUID=bfcf1ea9-6f70-4715-abab-73feb6a9077f /data ext4 defaults 0 0" >>/etc/fstab
- ## 挂载
- mount -a
复制代码
|
|