Image may be NSFW.
Clik here to view.
Clik here to view.

Oracle Linux 6.0 を使っていたら、lvremove -f
だと論理ボリューム (LV) の削除に失敗するものの、-f
オプションを外すと削除できるという問題が発生した。調べてみたら Red Hat Bugzilla: Bug 570359 – “lvremove -f” fails to remove an active logical volume に同様の問題が載っていたので、Red Hat Enterprise Linux (RHEL) 6.0 / CentOS 6.0 / Scientific Linux (SL) 6.0 などでも同様の解決策が取れるだろう。
環境
- OS: Oracle Linux 6.0 x86_64
- コンポーネント: lvm2-2.02.72-8.el6_0.4.x86_64
問題
Oracle Linux 6.0 で lvremove -f すると、以下のようなエラーで論理ボリューム (LV) が削除できない。
[root@bio ~] lvcreate -n lv_test -L 1m vg_system Rounding up size to full physical extent 32.00 MiB Logical volume "lv_test" created [root@bio ]# lvremove -f /dev/vg_system/lv_test LV vg_system/lv_test in use: not deactivating Unable to deactivate logical volume "lv_test"
しかし、-f
オプションを外すと同じLVが問題なく削除できる。
[root@bio ~]# lvremove /dev/vg_system/lv_test Do you really want to remove active logical volume lv_test? [y/n]: y Logical volume "lv_test" successfully removed
解決方法
/lib/udev/rules.d/80-udisks.rulesの以下の行をコメントアウトする。
[text title=”/lib/udev/rules.d/80-udisks.rules” firstline=”58″ highlight=”61″]……
Make udevd synthesize a ‘change’ uevent when last opener of a rw-fd closes the fd – this
should be part of the device-mapper rules
#KERNEL=="dm-*", OPTIONS+="watch"
……[/text]
[root@bio ~]# lvremove -f /dev/vg_system/lv_test Logical volume "lv_test" successfully removed
<
p class=”notice”>この調査には社内機密情報を一切使用していない。