System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

How to LVM PVCREATE in RHEL5 ?

 
SOLVED
Go to solution
Yaboto
Super Advisor

How to LVM PVCREATE in RHEL5 ?

Hi,

I successfully presented my EVA LUN through SAN to my RHEL5 system. Now I am struggling to configure it for data usage:


[root@localhost ~]#
[root@localhost ~]# pvcreate /dev/sda
Can't open /dev/sda exclusively. Mounted filesystem?
[root@localhost ~]# pvcreate /dev/sda1
Can't open /dev/sda1 exclusively. Mounted filesystem?
[root@localhost ~]# pvcreate -f /dev/sda
Can't open /dev/sda exclusively. Mounted filesystem?
[root@localhost ~]# pvcreate -f /dev/sda1
Can't open /dev/sda1 exclusively. Mounted filesystem?
[root@localhost ~]#

Please Advice.


Regards,
4 REPLIES
Matti_Kurkela
Honored Contributor

Re: How to LVM PVCREATE in RHEL5 ?

In a SAN, there are typically multiple paths that can be used to reach a particular LUN. In this situation, multipath support is required. There are many possible solutions for this.

Perhaps you've already installed and activated RedHat's device-mapper-multipath?

In that case, please see:

http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.4/html/DM_Multipath/index.html

MK
MK
Yaboto
Super Advisor

Re: How to LVM PVCREATE in RHEL5 ?


Yes I have already installed and activated DM-Multipath. Do I have to deactivate it before using LVM ?
I want to use LVM file systems.

Please Advice.

Matti_Kurkela
Honored Contributor
Solution

Re: How to LVM PVCREATE in RHEL5 ?

No, you should use the appropriate multipath device instead of /dev/sda.

Please run "multipath -l". The output will allow you to identify which multipath device corresponds to /dev/sda.

If you're using RedHat default settings, the multipath devices will be named like /dev/mapper/mpathN, where N is a number, beginning from 0.

So: "pvcreate /dev/mapper/mpath0", or whatever is the correct device.

If you have disabled the user_friendly_names option, the device name will be /dev/mapper/, where the is a long string of numbers.

You can also define your own custom alias names in /etc/multipath.conf, if you don't like the default names.

You should also edit your /etc/lvm/lvm.conf a little.

There is a "filter" line in the "devices" section which determines which devices LVM looks at when finding LVM PVs. You should replace the default filter with one that includes /dev/mapper/mpath* (or whatever) devices and excludes /dev/sd* devices.

With HP Proliant servers, a common configuration is that the system disk on a SmartArray controller (/dev/cciss/*) and all /dev/sd* devices are SAN LUN paths.

For this situation, a suitable filter might be:

filter = [ "a|^/dev/cciss/.*|", "a|^/dev/mapper/mpath.*|", "r|^/dev/sd.*|" ]

(= Accept for probing all /dev/cciss devices and /dev/mapper/mpath* devices, reject all /dev/sd* devices.)

There is also the preferred_names line. Comment out the default line that says:

preferred_names = [ ]

and uncomment the commented-by-default example, so it looks like this:

# Try to avoid using undescriptive /dev/dm-N names, if present.
preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]

After editing /etc/lvm/lvm.conf, run vgscan with -vv or even -vvv, and check that it really does what you want (i.e. checks all multipath devices, ignores all SAN single-path /dev/sd* devices and does not forget the system disk).

MK
MK
Yaboto
Super Advisor

Re: How to LVM PVCREATE in RHEL5 ?


Thank you !