rook: Bug: Disk usage not reclaimed when files are deleted
Is this a bug report or feature request?
- Bug Report
Deviation from expected behavior:
Disk space is not reclaimed.
Expected behavior:
Disk space should be reclaimed.
How to reproduce it (minimal and precise):
- Check disk usage using
ceph -sinside thetoolspod:
sh-4.2# ceph -s
cluster:
id: 8c25fdd8-64e3-4d8e-8f27-0e625529d7af
health: HEALTH_OK
services:
mon: 3 daemons, quorum a,b,c (age 14m)
mgr: a(active, since 44m)
osd: 3 osds: 3 up (since 44m), 3 in (since 44m)
data:
pools: 1 pools, 100 pgs
objects: 322 objects, 1.1 GiB
usage: 6.3 GiB used, 21 GiB / 27 GiB avail
pgs: 100 active+clean
io:
client: 26 KiB/s rd, 2.7 KiB/s wr, 31 op/s rd, 0 op/s wr
- exec into a container with rook pvc mount and create some files:
$ kubectl exec -it mypod sh
/container $ dd if=/dev/urandom of=sample1.txt bs=64M count=16
/container $ dd if=/dev/urandom of=sample2.txt bs=64M count=16
/container $ ls -al
-rw-r--r-- 1 nobody nogroup 536870896 Sep 11 20:38 sample.txt
-rw-r--r-- 1 nobody nogroup 536870896 Sep 11 20:41 sample2.txt
- Check that disk usage has grown, using
ceph -sinside thetoolspod:
sh-4.2# ceph -s
cluster:
id: 8c25fdd8-64e3-4d8e-8f27-0e625529d7af
health: HEALTH_OK
services:
mon: 3 daemons, quorum a,b,c (age 36m)
mgr: a(active, since 65m)
osd: 3 osds: 3 up (since 65m), 3 in (since 65m)
data:
pools: 1 pools, 100 pgs
objects: 471 objects, 1.7 GiB
usage: 8.1 GiB used, 19 GiB / 27 GiB avail
pgs: 100 active+clean
io:
client: 2.7 KiB/s wr, 0 op/s rd, 0 op/s wr
- Now delete those created files in the container:
$ kubectl exec -it mypod sh
/container $ rm -rf sample*.txt
/container $ ls -al
drwxr-xr-x 3 nobody nogroup 48 Sep 11 20:42 .
drwxr-xr-x 1 root root 4096 Sep 11 20:18 ..
- Re-check disk usage using
ceph -sinside thetoolspod:
sh-4.2# ceph -s
cluster:
id: 8c25fdd8-64e3-4d8e-8f27-0e625529d7af
health: HEALTH_OK
services:
mon: 3 daemons, quorum a,b,c (age 36m)
mgr: a(active, since 65m)
osd: 3 osds: 3 up (since 65m), 3 in (since 65m)
data:
pools: 1 pools, 100 pgs
objects: 471 objects, 1.7 GiB
usage: 8.1 GiB used, 19 GiB / 27 GiB avail
pgs: 100 active+clean
io:
client: 2.7 KiB/s wr, 0 op/s rd, 0 op/s wr
The disk usage did not fall.
Ceph cluster contains 3 mons, and 3 osds backed by 10GB bluestore replicapool with replicated: 3 on ssd. Container’s pvc size is 10Gi in pvc.yaml, as large as all of the available ceph disk space.
Environment:
- OS (e.g. from /etc/os-release): 18.04.1 LTS (Bionic Beaver)
- Kernel (e.g.
uname -a): 4.15.0-29 - Cloud provider or hardware configuration: baremetal
- Rook version (use
rook versioninside of a Rook Pod): v1.0.5 - Storage backend version (e.g. for ceph do
ceph -v): ceph version 14.2.1 - Kubernetes version (use
kubectl version): v1.15.1 - Kubernetes cluster type (e.g. Tectonic, GKE, OpenShift):
- Storage backend status (e.g. for Ceph use
ceph healthin the Rook Ceph toolbox): on-prem
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 34 (15 by maintainers)
I have fresh installation of rook version 1.3.5 (tag release-1.3) and I had the same issue with mount options on rbd
Rook version
rook-ceph-operator-config , i have used both ROOK_CSI_CEPH_IMAGE v2.1.0 and last v2.1.2
My storage class
Pod and pvc
Inside pod
mountOptions - has no effect
@Madhu-1
Thanks for your response @mywkaa. I am running okd 4.5 cluster so k8s 1.18.3. I have finally upgraded to rook 1.4.4 which also upgraded ceph csi to 3.x. Also I have recreated my storage class with discard option as fstrim was not working. With all above I can see osd space is freeing up. Just not sure yet of performance impact of mounting with discard option.
@leseb I’ve just tried this on
rook v1.1.0on acephfsStorageClasswith the followingmountOptionsand it did successfully reclaim the space.However, I prefer
rbdtocephfsso tried the samemountOptionsfor arbdStorageClassbut it did not work. Are you aware of any way to workaround this at the moment forrbd? Or any plan to supportrbdreclaiming soon?What version of k8s are you using ? For me helped update to 1.18
i was thinking its already there but it’s not present.Yes, we can add it.
You can specify mout option in storageclass, discard is just an example
https://github.com/ceph/ceph-csi/pull/848 should fix the issue for rbd.
Ping @Madhu-1 has this been addressed in the latest Ceph CSI release?