rbd du -p ssd | awk '
NR>1 {
size=$4
unit=$5
if (unit=="MiB") size=size
else if (unit=="GiB") size=size*1024
else if (unit=="TiB") size=size*1024*1024
print size " " unit " " $0
}' | sort -nr | head -n 50 | cut -d" " -f3-
by claude 3.5
效果:
root@pve1:~# rbd du -p ssd | awk '
NR>1 {
size=$4
unit=$5
if (unit=="MiB") size=size
else if (unit=="GiB") size=size*1024
else if (unit=="TiB") size=size*1024*1024
print size " " unit " " $0
}' | sort -nr | head -n 50 | cut -d" " -f3-
<TOTAL> 111 TiB 47 TiB
vm-1033-disk-0 20 TiB 20 TiB
vm-1054-disk-1@bak20240731 1000 GiB 677 GiB
vm-503-disk-3 500 GiB 500 GiB
vm-502-disk-3 500 GiB 500 GiB
vm-501-disk-3 500 GiB 500 GiB
vm-1054-disk-1@bak20231106 1000 GiB 475 GiB
vm-497-disk-0@backup0530 500 GiB 340 GiB
vm-1279-disk-1 320 GiB 320 GiB
vm-1090-disk-0 300 GiB 300 GiB