Project

General

Profile

Actions

Bug #52915

closed

rbd du versus rbd diff values wildly different when snapshots are present

Added by Alex Yarbrough over 2 years ago. Updated over 1 year ago.

Status:
Duplicate
Priority:
Normal
Target version:
-
% Done:

0%

Source:
Community (user)
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

root@ virtual335:~# ceph -v
ceph version 15.2.14 (e3964f3ac2e00e5baacdec60b36e45d1c2e8571b) octopus (stable)

I am trying to understand the values given by the du command for RBD images. They seem to have no basis in reality when snapshots are present. These are also the values shown on the "total provisioned" column of the RBD dashboard, so the stats given on that page are greatly overstated. Any GUI tools that are relying on rbd du I also believe to be wrong when snapshots are present.

Consider a 70 GiB disk attached to a VM that is always powered off. All of our VMs are snapped twice per day for 3 days and there is a rolling snapshot used for diff exports. This VM is always off, so there are always exactly zero writes occurring here.

root@virtual335:~# rbd du CephRBD_NVMe/vm-9994-disk-0
NAME PROVISIONED USED
vm-9994-disk-0@AutoSnap_10_09_2021_05_10_05 70 GiB 24 GiB
vm-9994-disk-0@AutoSnap_10_09_2021_19_07_45 70 GiB 24 GiB
vm-9994-disk-0@AutoSnap_10_10_2021_05_06_27 70 GiB 0 B
vm-9994-disk-0@AutoSnap_10_10_2021_19_08_09 70 GiB 0 B
vm-9994-disk-0@AutoSnap_10_11_2021_05_06_39 70 GiB 0 B
vm-9994-disk-0@AutoSnap_10_11_2021_19_05_01 70 GiB 0 B
vm-9994-disk-0@barcdaily20211012020457 70 GiB 0 B
vm-9994-disk-0@AutoSnap_10_12_2021_05_04_51 70 GiB 0 B
vm-9994-disk-0 70 GiB 0 B
<TOTAL> 70 GiB 47 GiB

Here, I would expect the parent disk, "vm-9994-disk-0," to show 24 GiB used, and all of the snapshots should show 0 bytes because that is the amount of writes that occurred on them. For the 2 oldest snaps to report the same value is nonsensical to me given that the VM is known to be off. There is no way 24 GiB of writes occurred in either of those snapshots. Of course the total on the bottom row should also display 24 GiB, not 47.

The total usage as calculated by rbd diff gives the precise and expected answer, 21.89 GiB:
root@ virtual335 :/# rbd diff CephRBD_NVMe/vm-9994-disk-0 | awk '{ SUM += $2 } END { print SUM/1024/1024/1024 }'
21.8914

After an rbd snap purge, the rbd du output returns to what is reasonable and expected:
root@ virtual335 :~# rbd du CephRBD_NVMe/vm-9994-disk-0
NAME PROVISIONED USED
vm-9994-disk-0 70 GiB 24 GiB

Because all of the snapshots were truly 0 bytes, running rbd diff after the snap purge gives the same exact value as before:
root@ virtual335 :/# rbd diff CephRBD_NVMe/vm-9994-disk-0 | awk '{ SUM += $2 } END { print SUM/1024/1024/1024 }'
21.8914

Now let me show you a disk attached to a VM that is always powered on. It is provisioned at 100 GiB. The total storage usage as reported by the guest file system is 41 GiB. The average write load is known to be around 6 GiB per day.

root@virtual335:/# rbd du CephRBD_NVMe/vm-101-disk-0
NAME PROVISIONED USED
vm-101-disk-0@AutoSnap_10_09_2021_05_02_06 100 GiB 70 GiB
vm-101-disk-0@AutoSnap_10_09_2021_19_03_05 100 GiB 70 GiB
vm-101-disk-0@AutoSnap_10_10_2021_05_02_24 100 GiB 10 GiB
vm-101-disk-0@AutoSnap_10_10_2021_19_03_25 100 GiB 11 GiB
vm-101-disk-0@AutoSnap_10_11_2021_05_02_26 100 GiB 12 GiB
vm-101-disk-0@AutoSnap_10_11_2021_19_02_27 100 GiB 19 GiB
vm-101-disk-0@barcdaily20211012020151 100 GiB 19 GiB
vm-101-disk-0@AutoSnap_10_12_2021_05_02_04 100 GiB 9.9 GiB
vm-101-disk-0 100 GiB 13 GiB
<TOTAL> 100 GiB 233 GiB

Same as in the first example, the 2 oldest snapshots have duplicate values while the parent disk shows an impossibly small value. I would expect the parent disk, "vm-9994-disk-0," to show something between 45 and 50 GiB. The sizes that du reports for the snapshots suggest a write load of 20-40 GiB per day. I have no idea where these values could be coming from, I cannot associate them with anything known to be occurring in the guest VM.

The total usage as calculated by rbd diff gives a much more reasonable answer, 68.39 GiB:
root@ virtual335 :/# rbd diff CephRBD_NVMe/vm-101-disk-0 | awk '{ SUM += $2 } END { print SUM/1024/1024/1024 }'
68.3906

Why does the du total show 233 GiB when rbd diff says 68.39 GiB?

After an rbd snap purge, the rbd du output returns something reasonable and expected for this VM:
root@ virtual335 :~# rbd du CephRBD_NVMe/vm-101-disk-0
NAME PROVISIONED USED
vm-101-disk-0 100 GiB 50 GiB

After the snap purge, calculating the usage on this disk again with rbd diff gives the correct answer, 48 GiB:
root@ virtual335 :~# rbd diff CephRBD_NVMe/vm-101-disk-0 | awk '{ SUM += $2 } END { print SUM/1024/1024/1024 }'
48.0205

(68.3906 - 48.0205) / 3 = 6.79 GiB per day in writes on this VM, which we know to be correct.

Not to belabor it but I will just quickly show one more VM to illustrate how the wild values get out of control:

root@virtual335:~# rbd du CephRBD_NVMe/vm-112-disk-0
NAME PROVISIONED USED
vm-112-disk-0@AutoSnap_10_09_2021_05_01_56 701 GiB 577 GiB
vm-112-disk-0@AutoSnap_10_09_2021_19_01_52 701 GiB 577 GiB
vm-112-disk-0@AutoSnap_10_10_2021_05_02_15 701 GiB 73 GiB
vm-112-disk-0@AutoSnap_10_10_2021_19_02_57 701 GiB 118 GiB
vm-112-disk-0@AutoSnap_10_11_2021_05_01_18 701 GiB 116 GiB
vm-112-disk-0@AutoSnap_10_11_2021_19_02_15 701 GiB 73 GiB
vm-112-disk-0@barcdaily20211012020059 701 GiB 76 GiB
vm-112-disk-0@AutoSnap_10_12_2021_05_01_18 701 GiB 62 GiB
vm-112-disk-0 701 GiB 81 GiB
<TOTAL> 701 GiB 1.7 TiB

This disk is 701 GiB with 469 GiB in use by the guest file system. Like the 2 examples before, the 2 oldest snaps have suspiciously duplicated size values. Like before, the parent disk (essentially the 0th snap) shows an impossibly small value of 81 GiB.

root@virtual335:~# rbd diff CephRBD_NVMe/vm-112-disk-0 | awk '{ SUM += $2 } END { print SUM/1024/1024/1024 }'
569.157

And rbd diff calculates 569 GiB in total usage, not 1.7 TiB. I think these wild values also throw off the displayed total usage on RBD pools.

So I either completely misunderstand the purpose of rbd du, or there is a bug to do with calculating usage on snaps. I need a quick, reliable, and precise way to get the size of a specific disk, specific snapshot, or the entire chain. I could create something myself but I wanted to report this so others can verify. While rbd diff is always very precise, we have hundreds of other disks, a lot larger than the examples given here, and rbd diff is an expensive calculation to run in bulk.


Files

screenshot.png (57 KB) screenshot.png Alex Yarbrough, 10/20/2022 03:39 PM

Related issues 2 (0 open2 closed)

Related to rbd - Bug #54440: Create test case to verify values of snaps in rbd duResolvedChristopher Hoffman

Actions
Is duplicate of rbd - Bug #50787: rbd diff between two snapshots lists entire image content with 'whole-object' switchResolvedSunny Kumar

Actions
Actions

Also available in: Atom PDF