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
:-
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
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.)
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
[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
destroy the partition by using dd
dd if=/dev/zero of=/dev/mapper/mpath23 bs=1024M
2nd Steps :-
Flush the unused multipath devices.
Flush the unused multipath devices.
multipath -F
3rd steps :-
restart the multipath services
4th Steps : pvcreate
/dev/mpath/mpath23
restart the multipath services
4th Steps : pvcreate
/dev/mpath/mpath23
Enjoy!!!!!!!!!!!!!!