# Storage group classification

The HDFS Balancer first invokes the getLiveDatanodeStorageReport rpc to the Namenode to the storage report for all the storages in all Datanodes. The storage report contains storage utilization information such as capacity, dfs used space, remaining space, and so forth, for each storage in each DataNode.

A Datanode can contain
multiple storages and the storages can have different storage types. A storage group
`Gi,T`

is defined to be the group of all the storages with the same
storage type `T`

in Datanode `i`

. For example,
`Gi,DISK`

is the storage group of all the DISK storages in Datanode
i. For each storage type T in each DataNode i, HDFS Balancer computes Storage Group
Utilization (%)

U_{i,T} = 100% (storage group used space)/(storage group
capacity),

and Average Utilization (%)

U_{avg,T} = 100% * (sum of all used spaces)/(sum of all
capacities).

Let △ be the threshold
parameter (default is 10%) and G_{I,T} be the storage group with storage type T
in DataNode I.

Over-Utilized: {G_{i,T}: U_{avg,T}+ Δ < U_{i,T}}, Average + Threshold --------------------------------------------------------------------------- Above-Average: {G_{i,T}: U_{avg,T}< U_{i,T}<= U_{avg,T}+ Δ}, Average --------------------------------------------------------------------------------------- Below-Average: {G_{i,T}: U_{avg,T}- Δ <= U_{i,T}<= U_{avg,T}}, Average - Threshold --------------------------------------------------------------------------- Under-Utilized: {G_{i,T}: U_{i,T}< U_{avg,T}- Δ }.

A storage group is over-utilized or under-utilized if its utilization is larger or smaller than the difference between the average and the threshold. A storage group is above-average or below-average if its utilization is larger or smaller than average but within the threshold.

If there are no over-utilized storages and no under-utilized storages, the cluster is said to be balanced. The HDFS Balancer terminates with a SUCCESS state. Otherwise, it continues with storage group pairing.