boxmoe_header_banner_img

About LVM Locking Type


avatar
admin 2026年9月2日 2026年9月2日 18

0 无锁(No Locking) – 不使用锁,此状态下不能并行执行命令,或者由使用者处理并行问题。
1 本地锁(Local Locking) – 当使用本地flock锁,只能在单机环境下使用;当use_lvmlockd=1时,同时使用lvmlockd提供的锁,可用于集群环境。
2 外部锁(External Locking) – 使用外部共享库提供的锁功能,可以在配置文件中设置库的名称,在共享库中只要按要求。
3 集群锁(Clustered Locking) – 使用内建的集群锁,必须配合clvmd来使用,同时必须关闭lvmetad缓存功能。
4 只读锁(Read-Only Locking) – 只读模式,禁止元数据修改。
5 哑巴锁(Dummy Locking) – 只读模式,被不需要锁的工具使用。

$ cat /etc/lvm/lvm.conf
...
 
	# Configuration option global/locking_type.
	# Type of locking to use.
	# 
	# Accepted values:
	#   0
	#     Turns off locking. Warning: this risks metadata corruption if
	#     commands run concurrently.
	#   1
	#     LVM uses local file-based locking, the standard mode.
	#   2
	#     LVM uses the external shared library locking_library.
	#   3
	#     LVM uses built-in clustered locking with clvmd.
	#     This is incompatible with lvmetad. If use_lvmetad is enabled,
	#     LVM prints a warning and disables lvmetad use.
	#   4
	#     LVM uses read-only locking which forbids any operations that
	#     might change metadata.
	#   5
	#     Offers dummy locking for tools that do not need any locks.
	#     You should not need to set this directly; the tools will select
	#     when to use it instead of the configured locking_type.
	#     Do not use lvmetad or the kernel device-mapper driver with this
	#     locking type. It is used by the --readonly option that offers
	#     read-only access to Volume Group metadata that cannot be locked
	#     safely because it belongs to an inaccessible domain and might be
	#     in use, for example a virtual machine image or a disk that is
	#     shared by a clustered machine.
	# 
	locking_type = 1
 
...
Bash


评论(0)

查看评论列表

暂无评论


发表评论

表情 颜文字
插入代码
后退
前进
刷新
复制
粘贴
全选
删除
返回首页
0%
目录
顶部
底部
📖 文章导读