The compact and repair process actually creates a new copy of the db. At the end of the process, if it completed sucessfully, the old copy is renamed and the new copy is given the original name. It is possible to compact in place but I wouldn't recommend it as if anything happens during the compact, you could easily loose your whole db.