大网数据广告活动
服务器运维问答

Unable to remove -- Logical volume in use

· 52CE 我爱测

I'm currently experiencing a problem where I cannot delete an lvm snapshot. The snapshot is not mounted nor is it ever mounted although its origin volume is. The command and response I'm getting is as #: lvremove -f lvs/lv0_snaps…

问题原文

原帖链接 · sreya · CC BY-SA 3.0

I'm currently experiencing a problem where I cannot delete an lvm snapshot. The snapshot is not mounted nor is it ever mounted although its origin volume is. The command and response I'm getting is as

#: lvremove -f lvs/lv0_snapshot
Logical volume lvs/lv0_snaphot in use.

df | grep lvs/lv0_snapshot and mount | grep lvs/lv0_snapshot return nothing which makes sense because I never mount it.

Does anyone know operations that would cause a logical volume, specifically a snapshot to be considered "in use"?

已采纳解答

原帖链接 · sreya · CC BY-SA 3.0

So as @Zoredache suggested lsof turned up a process referencing the snapshot.

It turns out that grub runs a program called os-prober it's purpose is to add OS's to the Grub menu, so what I think is happening is it's seeing my snapshot in /dev/mapper and mounting the device to ensure it's a mountable filesystem and something is happening to keep it from unmounting the filesystem. Since it doesn't get unmounted the lvm rationally refuses to let you delete the partition.

You can apparently disable the os-prober from running by setting GRUB_DISABLE_OS_PROBER=true in the etc/default/grub file.

If you simply want to be able to remove your logical volume you can run findmnt | grep <lv-name> and then run umount on the directory it returns. You should be able to remove the LV after that.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-04-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。