Some applications, for example Oracle when using raw logical volumes, may require specific access to logical volumes. Oracle will require that the raw logical volume is owned by the oracle account, and it may or may not require custom permissions.
The default values for a logical volume are: dev_uid=0 (owned by user root), dev_gid=0 (owned by group system) and dev_perm=432 (mode 660). You can check the current settings of a logical volume by using the readvgda command:
If the logical volume was create with or has been modified to use customized owner/group/mode values, the dev_values will show the current uid/gid/perm values, for example:# readvgda vpath51 | egrep "lvname|dev_|Logical" lvname: testlv (i=2) dev_uid: 0 dev_gid: 0 dev_perm: 432
When the volume group is exported, and re-imported, this information is lost:# chlv -U user -G staff -P 777 testlv # ls -als /dev/*testlv 0 crwxrwxrwx 1 user staff 57, 3 Mar 10 14:39 /dev/rtestlv 0 brwxrwxrwx 1 user staff 57, 3 Mar 10 14:39 /dev/testlv # readvgda vpath51 | egrep "lvname|dev_|Logical" lvname: testlv (i=2) dev_uid: 3878 dev_gid: 1 dev_perm: 511
To avoid this from happening, make sure to use the -R option, that will restore any specific settings:# errpt # exportvg testvg # importvg -y testvg vpath51 testvg # ls -als /dev/*testlv 0 crw-rw---- 1 root system 57, 3 Mar 10 15:11 /dev/rtestlv 0 brw-rw---- 1 root system 57, 3 Mar 10 15:11 /dev/testlv
Never use the chown/chmod/chgrp commands to change the same settings on the logical volume. It will work, however, the updates will not be written to the VGDA, and as soon as the volume group is exported out and re-imported on the system, the updates will be gone:# chlv -U user -G staff -P 777 testlv # ls -als /dev/*testlv 0 crwxrwxrwx 1 user staff 57, 3 Mar 10 15:11 /dev/rtestlv 0 brwxrwxrwx 1 user staff 57, 3 Mar 10 15:11 /dev/testlv # readvgda vpath51 | egrep "lvname|dev_|Logical" lvname: testlv (i=2) dev_uid: 3878 dev_gid: 1 dev_perm: 511 # varyoffvg testvg # exportvg testvg importvg -Ry testvg vpath51 testvg # ls -als /dev/*testlv 0 crwxrwxrwx 1 user staff 57, 3 Mar 10 15:14 /dev/rtestlv 0 brwxrwxrwx 1 user staff 57, 3 Mar 10 15:14 /dev/testlv
Notice above how the chlv command changed the owner to root, the group to system, and the permissions to 660. Even after the chown and chmod commands are run, and the changes are visible on the device files in /dev, the changes are not seen in the VGDA. This is confirmed when the volume group is exported and imported, even with using the -R option:# chlv -U root -G system -P 660 testlv # ls -als /dev/*testlv 0 crw-rw---- 1 root system 57, 3 Mar 10 15:14 /dev/rtestlv 0 brw-rw---- 1 root system 57, 3 Mar 10 15:14 /dev/testlv # chown user.staff /dev/testlv /dev/rtestlv # chmod 777 /dev/testlv /dev/rtestlv # ls -als /dev/*testlv 0 crwxrwxrwx 1 user staff 57, 3 Mar 10 15:14 /dev/rtestlv 0 brwxrwxrwx 1 user staff 57, 3 Mar 10 15:14 /dev/testlv # readvgda vpath51 | egrep "lvname|dev_|Logical" lvname: testlv (i=2) dev_uid: 0 dev_gid: 0 dev_perm: 360
So, when you have customized user/group/mode settings for logical volumes, and you need to export and import the volume group, always make sure to use the -R option when running importvg.# varyoffvg testvg # exportvg testvg # importvg -Ry testvg vpath51 testvg # ls -als /dev/*testlv 0 crw-rw---- 1 root system 57, 3 Mar 10 15:23 /dev/rtestlv 0 brw-rw---- 1 root system 57, 3 Mar 10 15:23 /dev/testlv
Also, make sure never to use the chmod/chown/chgrp commands on logical volume block and character devices in /dev, but use the chlv command instead, to make sure the VGDA is updated accordingly.
Note: A regular volume group does not store any customized owner/group/mode in the VGDA. It is only stored for Big or Scalable volume groups. In case you're using a regular volume group with customized owner/group/mode settings for logical volumes, you will have to use the chmod/chown/chgrp commands to update it, especially after exporting and re-importing the volume group.
If you found this useful, here's more on the same topic(s) in our blog:
- VIM Swap and backup files
- Install GNOME GUI on RHEL 7 Linux Server
- Copying a logical volume
- Using a pipeline
- How to mount/unmount an ISO CD-ROM image as a local file system
UNIX Health Check delivers software to scan Linux and AIX systems for potential issues. Run our software on your system, and receive a report in just a few minutes. UNIX Health Check is an automated check list. It will report on perfomance, capacity, stability and security issues. It will alert on configurations that can be improved per best practices, or items that should be improved per audit guidelines. A report will be generated in the format you wish, and the report includes the issues discovered and information on how to solve the issues as well.
Interested in learning more?
Interested in learning more?