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

The Geek Diary

CONCEPTS | BASICS | HOWTO

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

“Read-only locking type set. Write locks are prohibited. Can’t get lock for [volume group]” – error during lvextend

By admin

The Problem

Unable to extend LVM filesystem. The following error message is received on running the lvextend command:

Read-only locking type set. Write locks are prohibited.
Can't get lock for rootvg
resize2fs 1.43-WIP (20-Jun-2013)
The filesystem is already 1310720 blocks long. Nothing to do!

The Solution

The parameter locking_type is set to 4 in /etc/lvm/lvm.conf.

# grep locking lvm.conf |grep -v '#'

  "lvmetad", "metadata", "cache", "locking" ]
  locking_type = 4
  fallback_to_clustered_locking = 1
  fallback_to_local_locking = 1
  locking_dir = "/var/lock/lvm"

Setting the locking_type parameter to 4 enforces read-only metadata. Any operations that might want to modify the Volume Group metadata are forbidden.

Hence,the lvextend command fails when locking_type is set to 4 as it tries to modify the Volume Group metadata. Follow the steps outlined below to resolve the issue.

1. Take a backup of /etc/lvm/lvm.conf.
2. Edit the /etc/lvm/lvm.conf file and set the value of locking_type to 1.
3. Save the file.
4. Reboot the server.

The locking_type parameter should look like below when you do the changes:

#grep locking lvm.conf |grep -v '#'
-----
"lvmetad", "metadata", "cache", "locking" ]
locking_type = 1
fallback_to_clustered_locking = 1
fallback_to_local_locking = 1
locking_dir = "/var/lock/lvm"

locking_type parameter values

locking_type defines what type of locking is being used. The following is the list of parameter value and its description:

  • 0 – disables locking and also risks corrupting the metadata
  • 1(default) – which use flocks on files to avoid conflicting LVM2 commands running concurrently on a single machine.
  • 2 – the tools will load the external locking_library.
  • 3 – enforces built-in cluster-wide locking.
  • 4 – enforces read-only metadata and forbids any operations that might want to modify Volume Group metadata.

For more details on above values, kindly refer the man page for lvm.conf:

# man lvm.conf

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

Some more articles you might also be interested in …

  1. How to Boot into Rescue Mode or Emergency Mode Through Systemd in CentOS/RHEL 7 and 8
  2. CentOS / RHEL : How To Shrink LVM Root File System
  3. How to disable “Alt+Ctrl+Del” causing system reboot in CentOS/RHEL 7
  4. CentOS / RHEL : How to allow or deny Users to login to VSFTP Server
  5. How to scan newly Assigned LUNs in Multipathd under CentOS / RHEL
  6. Understanding SELinux File Labelling and SELinux Context
  7. How to check change log of RPM packages on CentOS/RHEL
  8. How to use FTP under Linux to transfer files
  9. CentOS / RHEL : How to add new swap partition
  10. Reducing/Limiting the CPUs in CentOS/RHEL 5,6

You May Also Like

Primary Sidebar

Recent Posts

  • SQL script to find tables that are fragmented
  • TRUNCATE TABLE not releasing space from tablespace
  • How to reclaim entire space of an oracle database table with “Truncate Table” statement
  • Oracle SQL Script to Report Tablespace Free and Fragmentation
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary