A method and apparatus is used to divide a storage volume into shards. The division
is made using a directed graph having a vertex for each block in the storage volume
and directed-edges between pairs of vertices representing a shard of blocks, associating
a weight with each directed edge that represents the dissimilarity for the shard
of blocks between the corresponding pair of vertices, selecting a maximum number
of shards (K) for dividing the storage volume, identifying a minimum aggregate
weight associated with a current vertex for a combination of no more than K shards,
performing the identification of the minimum aggregate weight for vertices in the
directed graph, and picking the smallest aggregated weight associated with the
last vertex to determine a sharding that spans the storage volume and provides
a minimal dissimilarity among no more than K shards of blocks.