Description
How to make changes to Veritas Volume Manager (VxVM) volume ownership and permissions persistent.
Issue:
By default, a newly created Veritas Volume Manager (VxVM) volume will only have read and write permissions for the root user. For example, the following shows a volume device for a volume named 'test' in the 'testdg' disk group:
# ls -l /dev/vx/dsk/testdg/test
brw------- 1 root root 79,76000 Jun 9 14:33 test
Depending on usage of the volume device, or for security reasons, it may be necessary to change the permissions or ownership of the volume. This can be done with the chmod and chown commands provided by the operating system. For example:
# chmod 777 /dev/vx/dsk/testdg/test
# ls -l/dev/vx/dsk/testdg/test
brwxrwxrwx 1 root root 79,76000 Jun 9 14:33 test
Note that each time the disk group is re-imported (or the machine rebooted) the volume device files will be recreated. This means that ownership and permission information for the volume will revert back to initial, default values (i.e. owned by root:root with permissions of 600).
Solution:
Use the vxedit command instead of chmod/chown to configure persistent ownership and/or permissions. This command has syntax as follows:
# vxedit -g set user= group= mode=
For example: we have a volume with initial, default ownership and permissions:
# ls -l /dev/vx/dsk/testdg/test
brw------- 1 root root 79,76000 Jun 9 14:33 test
We changed the mode to 777:
# vxedit -g testdg set mode=777 test
# ls -l/dev/vx/dsk/testdg/test
brwxrwxrwx 1 root root 79,76000 Jun 9 14:33 test
Example: change the owner to oracle:dba:
# vxedit -g testdg set user=oracle group=dba test
# ls -l /dev/vx/dsk/testdg
brwxrwxrwx 1 oracle dba 79,76000 Jun 9 14:33 test
# ls -l /dev/vx/rdsk/testdg
crwxrwxrwx 1 oracle dba 79,76000 Jun 9 14:33 test
As the vxedit command changes ownership and permission information for the volume in the disk group configuration. The device ownership and permissions will be restored when the device is recreated after subsequent disk group import.