• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

“mlock failed: Cannot allocate memory” lvcreate command error in CentOS/RHEL 7

by admin

The Problem

When attempting to create an LV the following error occurs.

# lvcreate -L 5G -n apps vgOS
  7fa0c6cd2000-7fa0c6cd3000 r-xp 00216000 fd:00 8388746 /usr/lib64/libgcc_s-4 .8.5-20150702.so.1: mlock failed: Cannot allocate memory
  7fa0c75ce000-7fa0c75cf000 r-xp 00265000 fd:00 8895769 /usr/lib64/libdevmapp er.so.1.02: mlock failed: Cannot allocate memory
  7fa0c77d6000-7fa0c77d7000 r-xp 00207000 fd:00 9313347 /usr/lib64/libdevmapp er-event.so.1.02: mlock failed: Cannot allocate memory
  7fa1c6f44000-7fa1c6f45000 r-xp 00203000 fd:00 8413569 /usr/lib64/libksplice _helper.so: mlock failed: Cannot allocate memory
  7fa1c7161000-7fa1c7162000 r-xp 0021c000 fd:00 8455088 /usr/lib64/libpthread -2.17.so: mlock failed: Cannot allocate memory
  7fa1c7466000-7fa1c7467000 r-xp 00304000 fd:00 8455032 /usr/lib64/libm-2.17. so: mlock failed: Cannot allocate memory
  7fa1c7825000-7fa1c7826000 r-xp 003be000 fd:00 8455021 /usr/lib64/libc-2.17. so: mlock failed: Cannot allocate memory
  7fa1c7a2e000-7fa1c7a2f000 r-xp 00208000 fd:00 8455092 /usr/lib64/librt-2.17 .so: mlock failed: Cannot allocate memory
  Logical volume "apps" created. 

The Solution

The issue is caused by the use_mlockall paramater in the LVM configuration file /etc/lvm/lvm.conf. As shown below the /etc/lvm/lvm.conf file has below entry:

# cat /etc/lvm/lvm.conf
use_mlockall = 0

Configuration option activation/use_mlockall

Prior to version 2.02.62, LVM used mlockall() to pin the whole process’s memory while activating devices, however, later versions of LVM, such as in the example above do not use this functionality. To implement the solution, please execute the following steps:

1. Log in to the server with root user.

2. Edit the /etc/lvm/lvm.conf configuration file and change the below value:

From

# vi /etc/lvm/lvm.conf
use_mlockall = 0

To

# vi /etc/lvm/lvm.conf
use_mlockall = 1

Note

“use_mlockall = 0” means in theory the memory used by lvm and its libs could get swapped out, but that should only affect you in low-memory situations. So, in most situations “mlock failed: Cannot allocate memory” is only informational message, unless you really have low free RAM.

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. Yum Fails with “Error: database disk image is malformed” in /var/log/messages
  2. How to allow only specific non-root user(s) to use crontab
  3. CentOS / RHEL 7 : Enable NTP to start at boot after fresh install (disable chrony)
  4. Search XML Attributes PowerShell XPath
  5. How to Disable rpc.quotad Service in CentOS/RHEL 6 and 7
  6. DNS configuration file /etc/named.rfc1912.zones explained
  7. EFS Mount Issue “Failed to resolve server: Name or service not known”
  8. How to disable write access to USB devices using “hdparm” tool
  9. CentOS / RHEL 7 : How to Change Timezone
  10. “Device /dev/mappper/mpath25 Not Found (or Ignored By Filtering)” – error while creating physical volume with pvcreate

You May Also Like

Primary Sidebar

Recent Posts

  • What are /dev/zero and /dev/null files in Linux
  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright