|
|
rbd删除卷时报错,反馈如下
' w- i" H$ P+ U1 S# rbd rm pool_name/volume_name
" F3 }0 w7 E r- p' }2021-10-25 10:32:42.192 7f789c502c80 -1 librbd::image::PreRemoveRequest: 0x5610334fcc40 check_image_snaps: image has snapshots - not removing+ g! r, L3 _8 X7 Q
Removing image: 0% complete...failed.
: I+ G' O2 j; [, L, B0 Qrbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.
6 z5 w0 ]5 B% S& U, k3 N$ |* }5 \/ }0 n9 S; m
3 u. J6 B. o2 s[root@compute05 data]# rbd rm images/39a2e9a9-2ce5-454a-bd66-47f15eeb11ea
8 {- Y; i# H0 N2 B2022-06-29 14:34:02.548 7fb15bf9db00 -1 librbd::image::PreRemoveRequest: 0x5607e27ae6f0 check_image_snaps: image has snapshots - not removing
' T. w+ m- e5 N% b4 TRemoving image: 0% complete...failed., F) l# E; o+ H/ P! a( ~- ?3 Q
rbd: image has snapshots - these must be deleted with 'rbd snap purge' before the image can be removed.
) r2 a. a' _+ ~7 U1 F5 b5 d3 J
* e0 V% h& K3 S5 j7 a8 o. `3 L2 _7 [5 j V" |$ B) ~
此时是因为有快照存在,所以无法删除。 使用snap list命令可以查看卷下快照,后snap rm删除即可。 若提示快照保护状态还需执行rbd unprotect进行解保护 1 Z6 Q; ?& x E' t0 ~* y% [, M
# rbd snap list pool_name/volume_name* q3 N2 |3 z, G' X" w
SNAPID NAME SIZE PROTECTED TIMESTAMP
9 Y1 N4 e( C) X 10 tempkoswji 1 GiB yes Tue Oct 19 11:16:07 2021
5 w; g. \9 S0 d& P+ F# rbd snap rm pool_name/volume_name@tempkoswji I/ m$ Z! Q( c; c- N1 p0 W, Y$ t! v
Removing snap: 100% complete...done.. K! T/ `1 S/ x# T
# rbd rm pool_name/volume_name/ x6 z& E- K. }/ [/ Q; [
Removing image: 100% complete...done.. N7 w: V/ K. R, G% m8 G
1234567
3 o- p# _) @' Y注:还存在一种情况,快照删除失败
- _" M+ X' r( P1 Z此时可能是快照做过克隆,需找到克隆出的卷,进行还原
9 Z2 q7 C7 X T* T* l. l! d# rbd flatten pool_name/kelong
% B- y6 A e% _- h/ S: r* o! T: m) P: F3 `3 y
还原之后对快照进行解保护,快照即可删除
; n( t% `, W/ {) L& B# N; I9 q( d: ~# rbd unprotect pool_name/volume_name@snap_name8 m7 V' _+ f$ t M! ]. O
" Q3 a: o L) I8 w- h! A |
|