风影子
作者风影子·2013-08-27 23:40
数据库管理员·深圳

linux下多路径管理一例

字数 11126阅读 3637评论 0赞 0
    之前给下级企业做了套系统集成方案,采购商按我的要求进行设备采购,现在设备已上架进入部署阶段。采购商在做完服务器系统安装、磁盘阵列划分等操作后要我远程检查环境,结果我发现映射过来的磁盘在系统中会显示两次,因为阵列是双控制器的,所以马上想到了多路径问题。所以提醒采购商的工程师要做双路径管理,但对方表示不会做,我在AIX中做过日立存储的多路径管理,linux系统中也没做过,只好在网上找了篇linux下多路径管理的文章要对方去研究下并要他多参考些文章来做,应当不难。
     采购方的工程师在参考网上的文章做完后要我检查,我发现不但之前识别到的阵列盘显示了两遍,而且多路径管理后识别的硬盘又显示了两遍,也就是同一盘显示了4次,说是找了很些篇文章,配置方法都差不多,不知道为什么会这样。只好自己研究了一下,做完后多路径管理识别的盘只有一个了,但最开始识别出来的阵列盘还是2次,我想在使用这个盘的时候直接使用多路径管理的这个盘应当就可以了,不知道对不对,后面部署的过程中应当就能验证了,现将处理过程记录一下。
      可能是因为映射过来的磁盘工程师用FDISK进行了分区的原因,识别出来的硬盘显示了两次,而他分别对这些硬盘都用FDISK做了分区,我在将分区全删除后再按网上的文章进行多路径管理,将服务重启后再做一次就可以了。

[root@x3650 mapper]# fdisk -l

 

Disk /dev/sda: 299.4 GB, 299439751168 bytes

255 heads, 63 sectors/track, 36404 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14       36404   292310707+  8e  Linux LVM

 

Disk /dev/sdb: 644.2 GB, 644245094400 bytes

255 heads, 63 sectors/track, 78325 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1       78325   629145531   83  Linux

 

Disk /dev/sdc: 644.2 GB, 644245094400 bytes

255 heads, 63 sectors/track, 78325 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1       78325   629145531   83  Linux

 

Disk /dev/dm-2: 644.2 GB, 644245094400 bytes

255 heads, 63 sectors/track, 78325 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

/dev/dm-2p1               1       78325   629145531   83  Linux

 

Disk /dev/dm-3: 644.2 GB, 644245023744 bytes

255 heads, 63 sectors/track, 78324 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/dm-3 doesn't contain a valid partition table

 

[root@x3650 mapper]# fdisk /dev/sdb

 

The number of cylinders for this disk is set to 78325.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

 

Command (m for help): m

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   l   list known partition types

   m   print this menu

   n   add a new partition

   o   create a new empty DOS partition table

   p   print the partition table

   q   quit without saving changes

   s   create a new empty Sun disklabel

   t   change a partition's system id

   u   change display/entry units

   v   verify the partition table

   w   write table to disk and exit

   x   extra functionality (experts only)

 

Command (m for help): d

Selected partition 1

 

Command (m for help): 1

1: unknown command

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   l   list known partition types

   m   print this menu

   n   add a new partition

   o   create a new empty DOS partition table

   p   print the partition table

   q   quit without saving changes

   s   create a new empty Sun disklabel

   t   change a partition's system id

   u   change display/entry units

   v   verify the partition table

   w   write table to disk and exit

   x   extra functionality (experts only)

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[root@x3650 mapper]# fdisk /dev/sdc

 

The number of cylinders for this disk is set to 78325.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

 

Command (m for help): m

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   l   list known partition types

   m   print this menu

   n   add a new partition

   o   create a new empty DOS partition table

   p   print the partition table

   q   quit without saving changes

   s   create a new empty Sun disklabel

   t   change a partition's system id

   u   change display/entry units

   v   verify the partition table

   w   write table to disk and exit

   x   extra functionality (experts only)

 

Command (m for help): d

Selected partition 1

 

Command (m for help): 1

1: unknown command

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   l   list known partition types

   m   print this menu

   n   add a new partition

   o   create a new empty DOS partition table

   p   print the partition table

   q   quit without saving changes

   s   create a new empty Sun disklabel

   t   change a partition's system id

   u   change display/entry units

   v   verify the partition table

   w   write table to disk and exit

   x   extra functionality (experts only)

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

[root@x3650 mapper]# /etc/init.d/multipathd stop

姝e湪鍏抽棴multipathd 彛鐩戞帶绋嬪簭锛?[60G[]

[root@x3650 mapper]# /etc/init.d/multipathd start

姝e湪鍚姩瀹堟姢杩涚▼multipathd?[60G[]

[root@x3650 mapper]# multipath –F

   Device Boot      Start         End      Blocks   Id  System

[root@x3650 mapper]# multipath -v2

create: mpath1 (360050763008080d14800000000000006)  IBM,2145

[size=600G][features=1 queue_if_no_path][hwhandler=0][n/a]

_ round-robin 0 [prio=50][undef]

 _ 7:0:0:0 sdb 8:16  [undef][ready]

_ round-robin 0 [prio=10][undef]

 _ 7:0:1:0 sdc 8:32  [undef][ready]

[root@x3650 mapper]# fdisk -l

 

Disk /dev/sda: 299.4 GB, 299439751168 bytes

255 heads, 63 sectors/track, 36404 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14       36404   292310707+  8e  Linux LVM

 

Disk /dev/sdb: 644.2 GB, 644245094400 bytes

255 heads, 63 sectors/track, 78325 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

 

Disk /dev/sdc: 644.2 GB, 644245094400 bytes

255 heads, 63 sectors/track, 78325 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

 

Disk /dev/dm-2: 644.2 GB, 644245094400 bytes

255 heads, 63 sectors/track, 78325 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

     Device Boot      Start         End      Blocks   Id  System

 

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

0

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广