Thursday, February 6, 2014

How to Configure Multipath on Oracle Linux

After creating new disk on SAN and presenting on host.. Scan the host bus  with below command on server;

echo "- - -" > /sys/class/scsi_host/host0/scan

Note: if you have more then one host bus then scan for each one by changing "host0"  to  "host1" and go on...

Output  Before Scanning host bus;

[root@testdb /]# cd /dev/disk/
[root@testdb disk]# ll
total 0
drwxr-xr-x. 2 root root 240 Feb  5 16:52 by-id
drwxr-xr-x. 2 root root 120 Feb  5 16:52 by-path
drwxr-xr-x. 2 root root 100 Feb  5 16:52 by-uuid
[root@testdb disk]# cd by-id/
[root@testdb by-id]# ll
total 0
lrwxrwxrwx. 1 root root 16 Feb  5 16:52 cciss-3600508b100184a39535748394f500006 -> ../../cciss/c0d0
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 cciss-3600508b100184a39535748394f500006-part1 -> ../../cciss/c0d0p1
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 cciss-3600508b100184a39535748394f500006-part2 -> ../../cciss/c0d0p2
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-name-vg_testdb-lv_root -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-name-vg_testdb-lv_swap -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-uuid-LVM-a84PMI5ipJD3bHQ3jD5MKMpRxCoXRWn0pBKsI1EsJVypftv78hkRRPbpJMvO71Q2 -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-uuid-LVM-a84PMI5ipJD3bHQ3jD5MKMpRxCoXRWn0zIvrWlJWKRoW126ZyzhSwd1Tr0Pyd7sx -> ../../dm-1
lrwxrwxrwx. 1 root root 16 Feb  5 16:52 wwn-0x600508b100184a39535748394f500006 -> ../../cciss/c0d0
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 wwn-0x600508b100184a39535748394f500006-part1 -> ../../cciss/c0d0p1
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 wwn-0x600508b100184a39535748394f500006-part2 -> ../../cciss/c0d0p2



Output After Scanning host bus;

[root@testdb by-id]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@testdb by-id]# ll
total 0
lrwxrwxrwx. 1 root root 16 Feb  5 16:52 cciss-3600508b100184a39535748394f500006 -> ../../cciss/c0d0
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 cciss-3600508b100184a39535748394f500006-part1 -> ../../cciss/c0d0p1
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 cciss-3600508b100184a39535748394f500006-part2 -> ../../cciss/c0d0p2
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-name-vg_testdb-lv_root -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-name-vg_testdb-lv_swap -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-uuid-LVM-a84PMI5ipJD3bHQ3jD5MKMpRxCoXRWn0pBKsI1EsJVypftv78hkRRPbpJMvO71Q2 -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-uuid-LVM-a84PMI5ipJD3bHQ3jD5MKMpRxCoXRWn0zIvrWlJWKRoW126ZyzhSwd1Tr0Pyd7sx -> ../../dm-1
lrwxrwxrwx. 1 root root  9 Feb  6 10:44 scsi-3600508b4001082ca0000a00006a40000 -> ../../sdg
lrwxrwxrwx. 1 root root 16 Feb  5 16:52 wwn-0x600508b100184a39535748394f500006 -> ../../cciss/c0d0
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 wwn-0x600508b100184a39535748394f500006-part1 -> ../../cciss/c0d0p1
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 wwn-0x600508b100184a39535748394f500006-part2 -> ../../cciss/c0d0p2
lrwxrwxrwx. 1 root root  9 Feb  6 10:44 wwn-0x600508b4001082ca0000a00006a40000 -> ../../sdg

Now we can see the new partion "sdg" created on SAN

Fdisk the new partion ;

root@testdb by-id]# fdisk /dev/sdg
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xfca3eebc.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130541, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-130541, default 130541):
Using default value 130541
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

[root@testdb by-id]# ll
total 0
lrwxrwxrwx. 1 root root 16 Feb  5 16:52 cciss-3600508b100184a39535748394f500006 -> ../../cciss/c0d0
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 cciss-3600508b100184a39535748394f500006-part1 -> ../../cciss/c0d0p1
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 cciss-3600508b100184a39535748394f500006-part2 -> ../../cciss/c0d0p2
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-name-vg_testdb-lv_root -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-name-vg_testdb-lv_swap -> ../../dm-1
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-uuid-LVM-a84PMI5ipJD3bHQ3jD5MKMpRxCoXRWn0pBKsI1EsJVypftv78hkRRPbpJMvO71Q2 -> ../../dm-0
lrwxrwxrwx. 1 root root 10 Feb  5 16:52 dm-uuid-LVM-a84PMI5ipJD3bHQ3jD5MKMpRxCoXRWn0zIvrWlJWKRoW126ZyzhSwd1Tr0Pyd7sx -> ../../dm-1
lrwxrwxrwx. 1 root root  9 Feb  6 10:47 scsi-3600508b4001082ca0000a00006a40000 -> ../../sdg
lrwxrwxrwx. 1 root root 10 Feb  6 10:47 scsi-3600508b4001082ca0000a00006a40000-part1 -> ../../sdg1
lrwxrwxrwx. 1 root root 16 Feb  5 16:52 wwn-0x600508b100184a39535748394f500006 -> ../../cciss/c0d0
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 wwn-0x600508b100184a39535748394f500006-part1 -> ../../cciss/c0d0p1
lrwxrwxrwx. 1 root root 18 Feb  5 16:52 wwn-0x600508b100184a39535748394f500006-part2 -> ../../cciss/c0d0p2
lrwxrwxrwx. 1 root root  9 Feb  6 10:47 wwn-0x600508b4001082ca0000a00006a40000 -> ../../sdg
lrwxrwxrwx. 1 root root 10 Feb  6 10:47 wwn-0x600508b4001082ca0000a00006a40000-part1 -> ../../sdg1 

Checking multipath is installed or not by following command ;

[root@testdb by-id]# rpm -qa device-mapper-multipath
device-mapper-multipath-0.4.9-64.0.1.el6.x86_64
if its not installed do following the below command on linux with root..

rpm -ivh device-mapper-multipath-0.4.9-64.0.1.el6.x86_64

If you do not need to edit the /etc/multipath.conf file, you can set up DM-Multipath for a basic failover configuration by running the following command

[root@testdb by-id]# mpathconf --enable --with_multipathd y
Starting multipathd daemon:                                [  OK  ]

making enable mpathconf

[root@testdb by-id]# mpathconf --enable
[root@testdb by-id]# mpathconf --help
usage: /sbin/mpathconf <command>
Commands:
Enable: --enable
Disable: --disable
Set user_friendly_names (Default n): --user_friendly_names <y|n>
Set find_multipaths (Default n): --find_multipaths <y|n>
Load the dm-multipath modules on enable (Default y): --with_module <y|n>
start/stop/reload multipathd (Default n): --with_multipathd <y|n>
chkconfig on/off multipathd (Default y): --with_chkconfig <y|n>

Checking multipath is working ?

root@testdb by-id]# multipath -ll
mpathb (3600508b4001082ca0000a00006a40000) dm-2 HP,HSV210
size=1000G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 0:0:1:1 sdb        8:16  active ready running
| |- 1:0:1:1 sde        8:64  active ready running
| `- 1:0:2:1 sdf        8:80  active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
  |- 0:0:0:1 sda        8:0   active ready running
  |- 0:0:2:1 sdc        8:32  active ready running
  |- 1:0:0:1 sdd        8:48  active ready running
  `- 1:0:3:1 sdg        8:96  active ready running 

As you see its active and running ... Now check under /dev/mapper/ for  mpathbp1 created by mpathb

  [root@testdb by-id]# cd /dev/mapper/
control                mpathb                 mpathbp1               vg_testdb-lv_root  vg_testdb-lv_swap


creating the new filesystem  to mount on different location (If you are going make the new ASM disk you dont need to do this)

 [root@testdb by-id]# mkfs.ext3 /dev/mapper/mpathbp1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536000 inodes, 262142637 blocks
13107131 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
8000 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848
Writing inode tables: mkfs.ext3 /dedone                            00000000000000000000000000
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Mounting new filesystem to different location...

mount /dev/mapper/mpathbp1 /test

Check wheter its mounted or not...

[root@testdb by-id]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_testdb-lv_root
                      250G  2.7G  234G   2% /
tmpfs                  20G  100K   20G   1% /dev/shm
/dev/cciss/c0d0p1     485M   55M  405M  12% /boot
/dev/mapper/mpathbp1  985G  200M  935G   1% /test ----> 1000 gb is ready to use under /test


   - Erol


No comments:

Post a Comment