Infrastructure at your Service

Preparing the storage devices for use with ASM is one of the first tasks you should do. When you do not want to use ASMLib then udev is what you should use for this. As the order/naming of the devices in the device tree is not guaranteed (e.g. dm-1 is not guaranteed to be the same device after a reboot of the system) you need a way to fix this and that is what udev can be used for.

The first step is to get the UUIDs of all the devices you want to use with ASM (dm-1 to dm-3, in this case). This assumes that multi pathing is already setup:

[[email protected] ~]$ udevadm info --query=all --name=/dev/dm-1 | grep -i DM_UUID
E: DM_UUID=mpath-3600a098000a819ff0000018559bf68d7
[[email protected] ~]$ udevadm info --query=all --name=/dev/dm-2 | grep -i DM_UUID
E: DM_UUID=mpath-3600a098000a81955000001b359bf6920
[[email protected] ~]$ udevadm info --query=all --name=/dev/dm-3 | grep -i DM_UUID
E: DM_UUID=mpath-3600a098000a819ff0000018359bf68ce

Having this the udev rules should look like this (of course the name does not need to be same as below):

[[email protected] ~]$ cat /etc/udev/rules.d/30-oracle.rules 
ACTION=="add|change", ENV{DM_UUID}=="mpath-3600a098000a81955000001b359bf6920", NAME="asm-crs",  OWNER="oracle", GROUP="asmadmin", MODE="0600"
ACTION=="add|change", ENV{DM_UUID}=="mpath-3600a098000a819ff0000018359bf68ce", NAME="asm-fra",  OWNER="oracle", GROUP="asmadmin", MODE="0600"
ACTION=="add|change", ENV{DM_UUID}=="mpath-3600a098000a819ff0000018559bf68d7", NAME="asm-data", OWNER="oracle", GROUP="asmadmin", MODE="0600"

Once the system rebooted the permissions on the devices should be fine and naming persistent:

[[email protected] ~]$ ls -al /dev/mapper/
total 0
drwxr-xr-x  2 root root     280 Oct  4 08:50 .
drwxr-xr-x 20 root root    4180 Oct  4 08:50 ..
lrwxrwxrwx  1 root root       7 Oct  4 13:10 asm-crs -> ../dm-2
lrwxrwxrwx  1 root root       7 Oct  4 13:10 asm-data -> ../dm-1
lrwxrwxrwx  1 root root       7 Oct  4 13:10 asm-fra -> ../dm-3
crw-------  1 root root 10, 236 Oct  4 08:50 control
lrwxrwxrwx  1 root root       7 Oct  4 12:51 disk00 -> ../dm-4
lrwxrwxrwx  1 root root       7 Oct  4 08:50 vg_root-lv_openafs -> ../dm-8
lrwxrwxrwx  1 root root       7 Oct  4 12:51 vg_root-lv_root -> ../dm-0
lrwxrwxrwx  1 root root       8 Oct  4 12:51 vg_root-lv_swap -> ../dm-10
lrwxrwxrwx  1 root root       7 Oct  4 12:51 vg_root-lv_tmp -> ../dm-7
lrwxrwxrwx  1 root root       7 Oct  4 12:51 vg_root-lv_var -> ../dm-6
lrwxrwxrwx  1 root root       7 Oct  4 12:51 vg_root-lv_var_log -> ../dm-5
lrwxrwxrwx  1 root root       7 Oct  4 12:51 vg_root-lv_var_log_audit -> ../dm-9
[[email protected] ~]$ ls -la /dev/dm*
brw-rw---- 1 root   disk     253,  0 Oct  4 12:51 /dev/dm-0
brw------- 1 oracle asmadmin 253,  1 Oct  4 13:11 /dev/dm-1
brw-rw---- 1 root   disk     253, 10 Oct  4 12:51 /dev/dm-10
brw------- 1 oracle asmadmin 253,  2 Oct  4 13:11 /dev/dm-2
brw------- 1 oracle asmadmin 253,  3 Oct  4 13:11 /dev/dm-3
brw-rw---- 1 root   disk     253,  4 Oct  4 12:51 /dev/dm-4
brw-rw---- 1 root   disk     253,  5 Oct  4 12:51 /dev/dm-5
brw-rw---- 1 root   disk     253,  6 Oct  4 12:51 /dev/dm-6
brw-rw---- 1 root   disk     253,  7 Oct  4 12:51 /dev/dm-7
brw-rw---- 1 root   disk     253,  8 Oct  4 08:50 /dev/dm-8
brw-rw---- 1 root   disk     253,  9 Oct  4 12:51 /dev/dm-9

Hope this helps.

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Daniel Westermann
Daniel Westermann

Principal Consultant & Technology Leader Open Infrastructure