• 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. blastp Command Examples in Linux
  2. How to setup passwordless SSH login in Linux
  3. CentOS / RHEL : How to add swap file
  4. mount: command not found
  5. How to Install Bless Hex Editor (Hexadecimal Editor) in Ubuntu
  6. xxd command – Expressed in hexadecimal form
  7. exec Command Examples in Linux
  8. CentOS / RHEL : How to add a new Physical Volume to an existing Volume Group
  9. What is the purpose of “system user” in MySQL Replication
  10. How to uninstall chromium-chromedriver from Ubuntu

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright