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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. ipset: command not found
  2. “error: Bind to port 2222 on 0.0.0.0 failed: Permission denied” – error while starting sshd service on CentOS/RHEL
  3. dkms: command not found
  4. Ubuntu Linux – OpenShot Video Editor
  5. script: command not found
  6. CentOS / RHEL 6 : How to password-protect single user mode
  7. Linux: No space left on device while df command shows a lot of free space
  8. vshadowmount: command not found
  9. ldconfig Command Options
  10. “github-label-sync” Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • “glab issue” Command Examples
  • “glab auth” Command Examples
  • “glab alias” Command Examples
  • gixy Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright