LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-31-2009, 09:43 AM   #1
srithi
LQ Newbie
 
Registered: Jul 2009
Posts: 9

Rep: Reputation: 0
How to change the LVM logical volume owner in RHEL 5.3


Hello,

We are running Sybase database in RHEL 5.3 and we use LVM block devices within Sybase. Shown below are some sample devices

/dev/mapper/syb_data_01-data01
/dev/mapper/syb_log_01-tlog01

We change the ownership of the above block devices to sybase and after a node reboot the ownership of the devices goes back to root. Are there any options in LVM to permanently change the ownership of the logical volumes?

I was thinking of putting a shell script in rc.local which will change the ownership of the Sybase devices during a node reboot. Is there a better way to achieve this?

Any suggestions would be greatly appreciated.

Thanks
 
Old 12-31-2009, 11:43 AM   #2
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 154Reputation: 154
I found this quite tricky, and the solution is a kludge, but works.

Here is a set of udev rules that I came up with to do exactly what you want, but for another reason.

Code:
SUBSYSTEM!="block",             GOTO="kvm_lvm_end"
KERNEL!="dm-*",                 GOTO="kvm_lvm_end"
ACTION!="add|change",               GOTO="kvm_lvm_end"

ENV{DM_NAME}=="vg1-kvm_[0-9]*_?*", OWNER:="root", GROUP:="kvm", MODE:="660", \
    RUN+="/bin/chgrp kvm /dev/mapper/$env{DM_NAME}"

LABEL="kvm_lvm_end"
Just edit them to suit your situation, and put them in a file under /etc/udev/rules.d/
then reload and rerun. I can't remember how to do that off the top of my head for RHEL

The kludge is having to execute chgrp, the device at this point will be /dev/dm-X where X is an incrementing number, but we also want the permissions to be correct for the /dev/mapper/vg-lv node

Last edited by phil.d.g; 12-31-2009 at 11:46 AM.
 
Old 12-31-2009, 12:27 PM   #3
srithi
LQ Newbie
 
Registered: Jul 2009
Posts: 9

Original Poster
Rep: Reputation: 0
How to change the LVM logical volume owner in RHEL 5.3

Thanks Phil. Actually, I don't directly use the dm-* devices, but create the Sybase logical volumes on top of it. So, should I still use KERNEL!="dm-*" OR should I specify a different kernel module name. Please let me know.

Thanks

Quote:
Originally Posted by phil.d.g View Post
I found this quite tricky, and the solution is a kludge, but works.

Here is a set of udev rules that I came up with to do exactly what you want, but for another reason.

Code:
SUBSYSTEM!="block",             GOTO="kvm_lvm_end"
KERNEL!="dm-*",                 GOTO="kvm_lvm_end"
ACTION!="add|change",               GOTO="kvm_lvm_end"

ENV{DM_NAME}=="vg1-kvm_[0-9]*_?*", OWNER:="root", GROUP:="kvm", MODE:="660", \
    RUN+="/bin/chgrp kvm /dev/mapper/$env{DM_NAME}"

LABEL="kvm_lvm_end"
Just edit them to suit your situation, and put them in a file under /etc/udev/rules.d/
then reload and rerun. I can't remember how to do that off the top of my head for RHEL

The kludge is having to execute chgrp, the device at this point will be /dev/dm-X where X is an incrementing number, but we also want the permissions to be correct for the /dev/mapper/vg-lv node
 
Old 12-31-2009, 12:34 PM   #4
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 154Reputation: 154
For every node in /dev/mapper/ there is a corresponding node that takes the form /dev/dm-X, they both point to the same block device.

dm-mod is the kernel module that gives the device mapper functionality so you want to keep the kernel module the same.

When the udev rule is triggered it's due to the creation of /dev/dm-X, at this time the node has already been created in /dev/mapper so aswell as applying the correct ownership and permissions to /dev/dm-X we also need to do it the node in /dev/mapper.

When I have some energy I intend to do look into it more and have a rule triggered on the creation of the /dev/mapper/ node, but one day at a time
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Resize Root LVM Logical Volume??? jdupre Fedora 17 10-02-2010 07:21 AM
LVM and dm-crypt -- best way to encrypt a logical volume? nyle Linux - Newbie 4 01-31-2009 01:53 PM
Growing an LVM Partition in Fedora 10 using Logical Volume Manager Lee_Ball Linux - General 1 01-29-2009 08:14 AM
Shrinking a Logical Volume With LVM jimmyjiang Red Hat 1 02-28-2008 04:45 PM
LVM: The Impact of Reducing a Logical Volume Size? muff Linux - General 0 07-27-2007 02:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration