본문 바로가기
IT/LINUX

[LINUX][RHEL6] multipath 사용하기

by 양눈 2016. 12. 19.

[LINUX][RHEL6] multipath 사용하기

테스트환경 : Redhat 6 2.6.32-431.el6.x86_64

 

스토리지에서 LUN을 할당 받은후 리눅스의 multipath를 사용하여 디스크를 사용하여 보자.

 

설치 ISO파일을 local repository로 설정하였다 

 

1. multipath 패키지 설치

-- 패키지 확인

[root@rhel6-test ~]# yum list | grep multipath
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
device-mapper-multipath.x86_64         0.4.9-72.el6                       local
device-mapper-multipath-libs.i686      0.4.9-72.el6                       local
device-mapper-multipath-libs.x86_64    0.4.9-72.el6                       local

-- 설치

[root@rhel6-test ~]# yum install -y device-mapper-multipath.x86_64
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-multipath.x86_64 0:0.4.9-72.el6 will be installed
--> Processing Dependency: device-mapper-multipath-libs = 0.4.9-72.el6 for package: device-mapper-multipath-0.4.9-72.el6.x86_64
--> Processing Dependency: libmultipath.so()(64bit) for package: device-mapper-multipath-0.4.9-72.el6.x86_64
--> Processing Dependency: libmpathpersist.so.0()(64bit) for package: device-mapper-multipath-0.4.9-72.el6.x86_64
--> Running transaction check
---> Package device-mapper-multipath-libs.x86_64 0:0.4.9-72.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                          Arch       Version            Repository
                                                                           Size
================================================================================
Installing:
 device-mapper-multipath          x86_64     0.4.9-72.el6       local     116 k
Installing for dependencies:
 device-mapper-multipath-libs     x86_64     0.4.9-72.el6       local     180 k

Transaction Summary
================================================================================
Install       2 Package(s)

Total download size: 297 k
Installed size: 653 k
Downloading Packages:
--------------------------------------------------------------------------------
Total                                            10 MB/s | 297 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : device-mapper-multipath-libs-0.4.9-72.el6.x86_64             1/2
  Installing : device-mapper-multipath-0.4.9-72.el6.x86_64                  2/2
  Verifying  : device-mapper-multipath-libs-0.4.9-72.el6.x86_64             1/2
  Verifying  : device-mapper-multipath-0.4.9-72.el6.x86_64                  2/2

Installed:
  device-mapper-multipath.x86_64 0:0.4.9-72.el6

Dependency Installed:
  device-mapper-multipath-libs.x86_64 0:0.4.9-72.el6

Complete!  --> 설치가 완료 되었다
 

2. 설정파일 생성 및 수정

패키지 설치 후 기본적으로 /etc/multipath.conf 파일이 존재하지 않는다.

무작정 데몬을 실행시키고, multipath 명령을 쳐보면 /etc/multipath.conf 파일이 없으니 sample파일이

/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf 여기에 있으니 가져다 쓰라고 나온다

어떤 파일인지 한번 가져와 보자

 

-- sample파일 copy  
[root@rhel6-test ~]# cp -p   /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf  /etc/multipath.conf

 

-- 파일을 열어 주석을 제거하자

[root@rhel6-test ~]# vi /etc/multipath.conf

 

blacklist {
#       wwid 26353900f02796769
       devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
       devnode "^hd[a-z]"
}

3. multipath 데몬 재시작

[root@rhel6-test ~]# service mulitpathd start

-- 리부팅시 자동 시작 되도록 설정  

[root@rhel6-test ~]# chkconfig multipathd on

 

4. 생성된 디바이스 확인

[root@rhel6-test ~]# multipath -ll
mpatha (360060e80100589f0052fb54f00000001) dm-0 HITACHI,DF600F
size=1000G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 2:0:0:0 sdb 8:16 active ready running
`-+- policy='round-robin 0' prio=0 status=enabled
`- 0:0:0:0 sda 8:0 active ready running

 

-- 조회 해보면 /dev/mapper/mpatha 라는 디바이스가 생성되었다

이제 이디바이스로 VG를 생성 하던지, 바로 파티션을 생성에 파일시스템을 만들수 있다.

 

 

5. 인터널 device가 multipath로 잡히는 경우

먼저 vi /etc/multipath.conf 파일에 인터널의 wwid를 추가해보고 multipath 데몬을 재시작

 

[root@rhel6-test ~]# vi /etc/multipath.conf

blacklist {
      wwid 36005076040a201a01b43f9aa380ff2ff
}

[root@rhel6-test ~]# service multipathd restart

 

로컬디스크 파일은 사라 졌으나 외장디스크가 mpathb로 표기된다면 강제로 인터널디스크로 생성된 wwid를 /etc/multipath/bindings 파일에서 주석 처리하고 mpathb로 변경하자

[root@rhel6-test ~]# vi /etc/multipath/bindings

 

#mpatha 36005076040a201a01b43f9aa380ff2ff
mpatha 360060e80100589f0052fb54f00000001

 

 

댓글