24 cubes, each 8 cubic inches, meaning each 2 inches on a side. So the dimensions must be even to fit cubes exactly. Our box with 9 inches is really only effectively 8 inches because that extra inch doesn't help us fit another cube.
So our total volume:


inches minimum