Writing to a hard disk is much faster if you write large sequential data in one part of the disk, instead of doing random writes i.
e. writing small bits of data all over the disk. Therefore we group many small objects together in one large container, and write this large container in one big sequential write operation to the hard disk.
However this creates a problem when deleting the small objects how can you reclaim the free space on-disk. This is a typical garbage collection problem.
Once in a while you want to rewrite containers by joining containers together and removing the deleted pieces such that you keep nice big containers on disk but you reclaim free space regularly.
This process is called compaction :
e. where can we reclaim most capacity with the least effort. How to predict what is going to be deleted.