• 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

“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. nft Command Examples in Linux
  2. cpulimit: command not found
  3. burpsuit Command Examples in Linux
  4. locale: command not found
  5. How to set custom device names using udev in CentOS/RHEL 7
  6. Change default kernel (boot with old kernel) in CentOS/RHEL/OEL 5 and 6
  7. apt-get Command Examples in Linux
  8. duperemove: command not found
  9. who: command not found
  10. How to Run SCP Without Password Prompt Interruption in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright