Oracle Grid 12c and Linux 7: PRVE-0421 : No entry exists in /etc/fstab for mounting /dev/shm

When you run Oracle Grid 12c ‘cluvfy stage -pre crsinst’ on Linux 7 (Oracle Enterprise Linux 7.2 in my case) you will get the following error:

Starting check for /dev/shm mounted as temporary file system ...

ERROR:

PRVE-0421 : No entry exists in /etc/fstab for mounting /dev/shm
PRVE-0421 : No entry exists in /etc/fstab for mounting /dev/shm
PRVE-0421 : No entry exists in /etc/fstab for mounting /dev/shm
PRVE-0421 : No entry exists in /etc/fstab for mounting /dev/shm

Check for /dev/shm mounted as temporary file system failed

When you do a ‘df -h’ you will see that ‘/dev/shm’ actually is mounted:

Filesystem Size Used Avail Use% Mounted on
devtmpfs 24G 0 24G 0% /dev
tmpfs    24G 0 24G 0% /dev/shm

This is due to a bug (Doc ID 2065603.1) which comes from the case that the cluvfy check does not check the actual mount of the file system, but looks for the persistence line of this mount in ‘/etc/fstab’ like it did in Linux 6. In Linux 7 you get this tmpfs mount by default.

The mounting entry

Now one can still add this line in ‘/dev/fstab’, but if you are happy with the current mount and space, you can leave it like it is. Otherwise you can add this:

tmpfs           /dev/shm        tmpfs   size=4g         0 0

This will create a new mount of ‘/dev/shm’ with (for this case) 4GB of space:

Filesystem Size Used Avail Use% Mounted on
devtmpfs  24G 0  24G 0% /dev
tmpfs    4.0G 0 4.0G 0% /dev/shm

As one can see, it’s really limited to the 4GB and you did lower it from the default of 24GB, which is not taken from the ‘/dev’ space:

[root@oracle1 shm]# ll
total 4194304
-rw-r--r--. 1 root root 1073741824 Jun 13 12:43 test1.img
-rw-r--r--. 1 root root 1073741824 Jun 13 12:43 test2.img
-rw-r--r--. 1 root root 1073741824 Jun 13 12:44 test3.img
-rw-r--r--. 1 root root 1073741824 Jun 13 12:44 test4.img

[root@oracle1 shm]# fallocate -l 1G test5.img
fallocate: test5.img: fallocate failed: No space left on device

[root@oracle1 shm]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ol_o1-root 50G 1.2G 49G 3% /
devtmpfs  24G    0 24G   0% /dev
tmpfs    4.0G 4.0G   0 100% /dev/shm

The original untouched ‘/dev/shm’ when creating large files shows this is also taking space from ‘/dev/shm’ and not ‘/dev’ itself:

[root@oracle2 shm]# fallocate -l 1G test5.img

[root@oracle2 shm]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 24G    0 24G  0% /dev
tmpfs    24G 5.0G 19G 22% /dev/shm

Also filling ‘/dev’ and ‘/dev/shm’ with more than the 24GB of memory (26GB in my case) will show even with the defaults it is not shared:

[root@oracle2 dev]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 24G 13G 11G 56% /dev
tmpfs    24G 13G 11G 56% /dev/shm

[root@oracle2 dev]# du -sch * | grep total
26G total

New and improved in Linux 7

You can see writing to tmpfs is taking away memory from the system, which is logical, but that ‘tmpfs’ resides in ‘buff/cache’ and is also reported in ‘shared’:

[root@oracle2 dev]# free
         total     used       free     shared buff/cache  available
Mem:  49184152   390916   21194876   27271860   27598360   21356000
Swap: 24367100        0   24367100

-- after removing the 26GB of test files:

[root@oracle2 dev]# free
         total     used       free     shared buff/cache  available
Mem:  49184152   391524   48518616       8884     274012   48641694
Swap: 24367100        0   24367100

A good thing is that Linux 7 subtracts this shared memory from a new column ‘available’, as this subtraction was not the case in Linux 6 !!! You can see it here:

[root@oel6 ~]# free
          total      used      free   shared   buffers   cached
Mem:     223236    217336      5900      324     86852    40928
-/+ buffers/cache:  89556    133680

[root@oel6 shm]# dd if=/dev/urandom of=sample.txt bs=1M count=50

[root@oel6 shm]# free
          total      used      free   shared   buffers   cached
Mem:     223236    216716      6520    51524     46468    81116
-/+ buffers/cache:  89132    134104

[root@oel6 shm]# df -h
Filesystem   Size   Used   Avail   Use%   Mounted on
tmpfs        109M   50M      59M    46%     /dev/shm

I have created a 50MB file in ‘/dev/shm’ and it does not take memory from ‘anywhere’. It moves ~50MB buffers (which includes free memory from tmpfs for ‘pre-reservation’) to cached, but it does not show any difference from `-/+ buffers/cache` in used or free!!!

Happy um… memory sharing… ;)

Tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *