上一篇我们用losetup建了一个iscsi卷,现在空间不够了,需要释放掉之前建立的iscsi-volumes的20T空间。
首先去isci卷的宿主机查看一下
1targetcli ls /
开始删除,先删除backstores,然后是iscsi,lv,vg,pv:
1# targetcli /backstores/block delete vg-targetd:pvc-harbor
2Deleted storage object vg-targetd:pvc-harbor.
3# targetcli /backstores/block delete vg-targetd:pvc-vis-18-31-48
4Deleted storage object vg-targetd:pvc-vis-18-31-48.
5# targetcli /backstores/block delete vg-targetd:pvc-vis-18-31-49
6Deleted storage object vg-targetd:pvc-vis-18-31-49.
7
8# targetcli /iscsi delete iqn.2020-07.com.ddky:renhe-18-30-18
9Deleted Target iqn.2020-07.com.ddky:renhe-18-30-18.
10# targetcli /iscsi delete iqn.2020-10.com.ddky:vis-18-31-48
11Deleted Target iqn.2020-10.com.ddky:vis-18-31-48.
12# targetcli /iscsi delete iqn.2020-10.com.ddky:vis-18-31-49
13Deleted Target iqn.2020-10.com.ddky:vis-18-31-49.
14
15# lvs
16 LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
17 pvc-harbor vg-targetd -wi-a----- 200.00g
18 pvc-vis-18-31-48 vg-targetd -wi-a----- 80.00g
19 pvc-vis-18-31-49 vg-targetd -wi-a----- 80.00g
20# lvremove /dev/vg-targetd/pvc-harbor
21Do you really want to remove active logical volume vg-targetd/pvc-harbor? [y/n]: y
22 Logical volume "pvc-harbor" successfully removed
23# lvremove /dev/vg-targetd/pvc-vis-18-31-48
24Do you really want to remove active logical volume vg-targetd/pvc-vis-18-31-48? [y/n]: y
25 Logical volume "pvc-vis-18-31-48" successfully removed
26# lvremove /dev/vg-targetd/pvc-vis-18-31-49
27Do you really want to remove active logical volume vg-targetd/pvc-vis-18-31-49? [y/n]: y
28 Logical volume "pvc-vis-18-31-49" successfully removed
29
30# vgremove vg-targetd
31 Volume group "vg-targetd" successfully removed
32# lvs
33# vgs
34# pvs
35 PV VG Fmt Attr PSize PFree
36 /dev/loop0 lvm2 --- 19.53t 19.53t
37
38# pvremove /dev/loop0
39 Labels on physical volume "/dev/loop0" successfully wiped.
一整套下来,基本都干净了。
最后清理文件,注意如果不停掉targetd服务,是无法remove loop设备的
1systemctl stop targetd
2losetup -a
3losetup -d /dev/loop0
4losetup -a
5cd /glusterfs/iscsi-volumes
6rm -f k8s-iscsi-volumes.img
这样就多了20T磁盘空间。