• 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

lvdisplay error: “Failed to create directory /var/lock/lvm. File-based locking initilisation failed.”

by admin

The Problem

lvdisplay command prints the below error on a CentOS/RHEL 6 system:

# lvdisplay
Failed to create directory /var/lock/lvm
File-based locking initilisation failed.

The Solution

The above error is due to the /var file system is mounted as read only. To resolve the issue, follow the steps outlined below:

1. Edit and modify /etc/lvm/lvm.conf as below:

locking_dir = "/var/lock/lvm"

to

locking_dir = "/tmp/lock/lvm"

2. Run the lvm commands by defining temporary locking directory:

# lvdisplay --config 'global { locking_dir = "/tmp" } '
# pvdisplay --config 'global { locking_dir = "/tmp" } '
# vgdisplay --config 'global { locking_dir = "/tmp" } ' 

Making Changes Permanent

Mount the /var filesystem with rw option or if the filesystem is read-only due to filesystem corruption, run fsck against the unmounted /var partition to fix it, but ensure you have a valid backup before running fsck.

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, Linux

Some more articles you might also be interested in …

  1. lynis Command Examples in Linux
  2. “git summary” Command Examples
  3. cabal: Command-line interface to the Haskell package infrastructure (Cabal)
  4. a2query: command not found
  5. How to disable swap in Linux
  6. “git reauthor” Command Examples
  7. Invalid ABI Option abi=aapcs-linux
  8. ghdl: Open-source simulator for the VHDL language
  9. Failed to start LSB: Bring up/down networking – On restarting network service CentOS/RHEL (DHCP client)
  10. “ntpq -pn” command returns with error “Name or service not known”

You May Also Like

Primary Sidebar

Recent Posts

  • “glab alias” Command Examples
  • gixy Command Examples
  • gitsome Command Examples
  • gitmoji Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright