Gmsh, boundaries, Output,

This is because you need to use Boolean Fragments in your geo file. Currently, the box and the torus is meshed has individual meshes.
In the reply

This is done with the command:

I’ve also shown how to use it with the geo files in: Transitioning from mesh.xml to mesh.xdmf, from dolfin-convert to meshio - #62 by dokken

You can realize this mistake by looking at your output. You get the volume 8 by integrating dx(2) which is the whole box.