LVM - 刪除 cinder volume 出現remove ioctl on failed: Device or resource busy


$ lvdisplay --- Logical volume --- LV Path /dev/cinder-volumes/volume-8394a77f-c9b6-426d-b31d-33d0682b394f LV Name volume-8394a77f-c9b6-426d-b31d-33d0682b394f VG Name cinder-volumes LV UUID vWeepZ-rbPL-tKas-Om26-ziQg-F3vF-aINUXE LV Write Access read/write LV Creation host, time controller, 2016-05-30 11:59:02 +0800 LV Status available # open 1 LV Size 1.00 GiB Current LE 256 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 252:0

# 今天想刪除volume-8394a77f-c9b6-426d-b31d-33d0682b394f,結果報錯
$ lvremove /dev/cinder-volumes/volume-8394a77f-c9b6-426d-b31d-33d0682b394f device-mapper: remove ioctl on failed: Device or resource busy

# 強制刪除也一樣
$ lvremove -f /dev/cinder-volumes/volume-8394a77f-c9b6-426d-b31d-33d0682b394f device-mapper: remove ioctl on failed: Device or resource busy

# 可以看到open 的狀態為1,所以remove不掉
$ dmsetup info -c /dev/cinder-volumes/volume-8394a77f-c9b6-426d-b31d-33d0682b394f Name Maj Min Stat Open Targ Event UUID cinder--volumes-volume--8394a77f-c9b6-426d-b31d-33d0682b394f 252 0 L--w 1 1 0 LVM-88RRijIEC84Kmm9DX6LgMfpOHUrSGwakKfSSKW0lcdGctxXZjmupVUTxRu5BMCem

# 查詢看誰打開的

$ fuser -m 8394a77f-c9b6-426d-b31d-33d0682b394f 

/dev/dm-0:            5222

# 可以知道所對應的device是/dev/dm-0,可能是被mount了,所以先試試umount
$umount /dev/dm-0
umount: /dev/dm-0: not mounted

# 最後應該是tgtd的問題了
$ tgtadm --op show --mode target|grep 8394a77f
Target 1: iqn.2010-10.org.openstack:volume-8394a77f-c9b6-426d-b31d-33d0682b394f Backing store path: /dev/cinder-volumes/volume-8394a77f-c9b6-426d-b31d-33d0682b394f

# 刪除試試看
$ tgtadm --op show --mode target --op delete --tid 1

# 應該就可以正常刪除lv了
$ lvremove /dev/cinder-volumes/volume-8394a77f-c9b6-426d-b31d-33d0682b394f


留言

這個網誌中的熱門文章

Python - 計算特定目錄底下的檔案以及目錄數量

PHP - 產生qrcode

devstack安裝all in one openstack(pike)