Chinaunix首页 | 论坛 | 博客
  • 博客访问: 287186
  • 博文数量: 81
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 35
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-19 15:16
文章分类

全部博文(81)

文章存档

2021年(1)

2016年(3)

2015年(6)

2014年(6)

2013年(33)

2012年(32)

分类: LINUX

2013-06-19 02:41:27

Can't open /dev/mapper/mpath23 exclusively. Mounted filesystem?

dm multipath issue in Red Hat Linux
Can't open /dev/mapper/mpath23 exclusively.  Mounted filesystem?
Reasons:-
Once a partition has already been created on a multipath device the pvcreate /dev/mapper/mpath device will fail since it has already been locked by the partition that resides on there.
Diagnostic Steps and Tips
:-
Check the output of ls -al /dev/mapper* to verify if the mpath device exists
[parag@beautifulworld ~]#
pvcreate -f /dev/mapper/mpath23

  Can't open /dev/mapper/mpath8 exclusively.  Mounted filesystem?
What happens is that the "partition" mpath23p1 is a linear device-map holding mpath23p1. This holder is the reason which the open-exclusive test tried by pvcreate fails.
Tips
1:- (not recommended always but we did one successful change  on production server.)
We can use pvcreate on a partition which works fine

[parag@beautifulworld ~]#pvcreate –f/ dev/mapper/mpath23p1
 Physical volume "/dev/mapper/mpath23p1" successfully created
[parag@beautifulworld ~]#
Tips 2:- (Always recommended)
Remove all existing partitions that reside on the device(i.e fdisk /dev/mapper/mpath23) using fdisk or parted(if fs is more than 2TB). Once the partitions are removed execute the kpartx command against the device to remove the kernel partition mappings, and pvcreate against the complete block device should succeed.
[parag@beautifulworld ~]#kpartx -d /dev/mapper/mpath23 
[parag@beautifulworld ~]#pvcreate /dev/mapper/mpath23
Tips 3:- ( Be careful with dd command , if you wrongly select the path  it will destroy other file system as well)
1st Steps:-
destroy the partition by using dd
dd if=/dev/zero of=/dev/mapper/mpath23  bs=1024M
2nd Steps :-
Flush the unused multipath devices.
multipath -F
3rd steps       :-     
restart the multipath services



4th Steps      :       pvcreate
/dev/mpath/mpath23
Enjoy!!!!!!!!!!!!!!
阅读(7291) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~