Created
May 30, 2014 03:07
-
-
Save zhanghui9700/a80369b43c50a05755f8 to your computer and use it in GitHub Desktop.
resize cinder volume pv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
关于lvremove删除openstack cinder volume所对应的逻辑卷的方法 | |
按照我的理解,openstack里的cinder volume创建、管理磁盘实际是用tgtadm管理的来自网络中的lvm磁盘。 | |
有时cinder volume一直处于creating状态或者deleting状态,下层磁盘用不了也删不掉,占了很大的磁盘空间。既然它是用lvm管理的所以可以用lvm相关的工具来删除它。 | |
先找到要删除的volume的lvm路径lvdisplay,我的是:/dev/cinder-vol/volume-725230c0-558a-422a-b9aa-5f309ed42798 | |
直接lvremove /dev/cinder-vol/volume-725230c0-558a-422a-b9aa-5f309ed42798 | |
结果报错:device-mapper: remove ioctl on failed: Device or resource busy。好吧设备繁忙。 | |
再看:dmsetup info -c /dev/cinder-vol/volume-725230c0-558a-422a-b9aa-5f309ed42798 | |
Name Maj Min Stat Open Targ Event UUID | |
cinder–vol-volume–725230c0–558a–422a–b9aa–5f309ed42798 252 5 L–w 1 1 0 LVM-CMpL6mPY7LjVj3tIuF3YNvDyBtXqsmymJRiBrju5UXaoeWXxPqvAx9cLX3DlNTZI | |
可以看到open 为1说明它被打开了,所以remove不掉。 | |
看看是谁打开的: | |
fuser -m /dev/cinder-vol/volume-725230c0-558a-422a-b9aa-5f309ed42798 | |
/dev/dm-5: 5214 | |
它对应的下层块设备是/dev/dm-5,可能是因为它被mount了所以尝试:umount /dev/dm-5 | |
umount: /dev/dm-5: not mounted | |
结果是没mount。。 | |
看来应该是因为tgtd使用了这个逻辑卷,查看一下: | |
tgtadm –-op show –-mode target|grep 7252 | |
Target 3: iqn.2010-10.org.openstack:volume-725230c0-558a-422a-b9aa-5f309ed42798 | |
Backing store path: /dev/cinder-vol/volume-725230c0-558a-422a-b9aa-5f309ed42798 | |
果然,删除之:tgtadm -–op show –-mode target –-op delete –-tid 3 | |
再来看看文件打开状态 | |
dmsetup info -c /dev/cinder-vol/volume-725230c0-558a-422a-b9aa-5f309ed42798 | |
Name Maj Min Stat Open Targ Event UUID | |
cinder–vol-volume–725230c0–558a–422a–b9aa–5f309ed42798 252 5 L–w 0 1 0 LVM-CMpL6mPY7LjVj3tIuF3YNvDyBtXqsmymJRiBrju5UXaoeWXxPqvAx9cLX3DlNTZI | |
好了现在可以删除了: | |
lvremove /dev/cinder-vol/volume-725230c0-558a-422a-b9aa-5f309ed42798 | |
### | |
dd if=/dev/zero of=/path/100GB.file bs=1 count=0 seek=100G | |
losetup -f | |
losetip /dev/loopN /path/100GB.file | |
pvcreate /dev/loopN | |
vgcreate cinder-volumes /dev/loopN | |
pvscan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment