Ceph分布式存储cephSecurity

Ceph块存储-4·删除快照

2022-11-27  本文已影响0人  技术老男孩

删除一个受保护的快照困难重重,那就演示一下如何一步步操作进行删除的

一、删除镜像步骤思路:

二、开始实操

第一步:将受保护的镜像修改为不受保护

[root@crontrol7 ~]# rbd ls
mysql
mysql-snap1-1
mysql-snap1-2
new
[root@crontrol7 ~]# rbd showmapped
id pool image snap device    
0  rbd  mysql -    /dev/rbd0 
[root@crontrol7 ~]# rbd snap purge mysql
Removing all snapshots: 0% complete...failed.
rbd: snapshot 'mysql-snap1' is protected from removal.
# 将mysql镜像中的快照mysql-snap1取消保护
[root@crontrol7 ~]# rbd snap unprotect mysql --snap mysql-snap1
2022-11-28 11:36:41.231903 7f22ee444700 -1 librbd::SnapshotUnprotectRequest: cannot unprotect: at least 2 child(ren) [104b2ae8944a,104f238e1f29] in pool 'rbd'
2022-11-28 11:36:41.231918 7f22ee444700 -1 librbd::SnapshotUnprotectRequest: encountered error: (16) Device or resource busy
2022-11-28 11:36:41.231927 7f22ee444700 -1 librbd::SnapshotUnprotectRequest: 0x5642da665db0 should_complete_error: ret_val=-16
rbd: unprotecting snap failed: (16) Device or resource busy
2022-11-28 11:36:41.235134 7f22ee444700 -1 librbd::SnapshotUnprotectRequest: 0x5642da665db0 should_complete_error: ret_val=-16
[root@crontrol7 ~]# rbd rm mysql-snap1-1
Removing image: 100% complete...done.
[root@crontrol7 ~]# rbd rm mysql-snap1-2
Removing image: 100% complete...done.
[root@crontrol7 ~]# rbd snap unprotect mysql --snap mysql-snap1

第二步:删除镜像下面的所有快照

[root@crontrol7 ~]# rbd snap purge mysql
Removing all snapshots: 100% complete...done.
[root@crontrol7 ~]# rbd rm mysql 
2022-11-28 11:39:47.365860 7fbe4859fd80 -1 librbd: image has watchers - not removing
Removing image: 0% complete...failed.
rbd: error: image still has watchers
This means the image is still open or the client using it crashed. Try again after closing/unmapping it or waiting 30s for the crashed client to timeout.

第三步:取消访问者挂载连接

[root@crontrol7 ~]# rbd status mysql
Watchers:
    watcher=192.168.88.253:0/3603526388 client.4172 cookie=18446462598732840961
# 解除挂载
[root@crontrol7 ~]# umount /mnt
# 解除映射
[root@crontrol7 ~]# rbd unmap mysql
# 再次确认watcher,显示none为正常
[root@crontrol7 ~]# rbd status mysql
Watchers: none

第四步:rbd删除镜像

[root@crontrol7 ~]# rbd rm mysql
Removing image: 100% complete...done.
上一篇下一篇

猜你喜欢

热点阅读