Setting ownership of block devices in rhel6¶
- Title:
Setting ownership of block devices in rhel6
- Author:
Douglas O’Leary <dkoleary@olearycomputers.com>
- Description:
Setting ownership of block devices in rhel6
- Date created:
11/2013
- Date updated:
11/2013
- Disclaimer:
Standard: Use the information that follows at your own risk. If you screw up a system, don’t blame it on me…
Overview¶
Google searches for how to update device permissions will lead to many hits most of which contradict each other. I found a very complete guide on the archlinux wiki which has a link pointing to writing udev rules
Details:¶
- Rules notes (emphasis on data from the links above)
Rules are listed in /etc/udev/rules.d directory and are evaluated in order.
the ‘=’ is for assignment, ‘==’ is for evaluation. This will be more clear a few lines
Reading through those links above and others, you’ll quickly realize that there are alot of options. Fortunately, we don’t need many.
Parameter |
Meaning |
---|---|
KERNEL==”sd*” |
applies to all sd devices |
SUBSYSTEM==”block” |
applies to all block devices |
ENV{DEVTYPE}==”disk” |
applies if device type is disk |
ENV{ID_SERIAL}==${wwid} |
applies if the wwid matches. |
OWNER=”hdp9adm” |
set the owner |
GROUP=”hdp9adms” |
set the group |
MODE=”0660” |
set the permissions |
An example of one entry in client defined rule file. Line split for readability only. Ensure the rule is on one and only one line:
# head -1 /etc/udev/rules.d/95\-hadoop\-disks.rules KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \ ENV{ID_SERIAL}=="3600605b005dd7110196075e3db43ed1c", \ OWNER="hdp9adm", GROUP="hdp9adms", MODE="0660"
Where to get the wwid? That’s the subject of another ll entry: ID WWD for a LUN
Summary:¶
Like most things, this is easy if you know what you’re doing. Finding consistent information was a bit of a challenge. The process above seems like the simplest approach. Other approaches included running scripts from within the rules files, etc. Seems like overkill for the instance that I had to support.