The new box will be supported by a ceiling fan brace. You can get one at any Home Center slip. The brace into the ceiling and Center it over the hole.
Can I mount a ceiling fan box directly to a joist?
Presuming you don't have access to the ceiling fan from above, you must either use a specially rated hanger and box to mount the fan between joists or, better yet, screw a fan-rated “pancake” box (so called because it's very thin) directly to a ceiling joist.
Should a ceiling fan box be flush with drywall?
Since electrical junction boxes must be accessible, not behind drywall, the only way to get a good fit and finish it to mount it correctly so it's flush to the drywall.
Can a 2x4 support a ceiling fan?
Anyway, yes, if the 2x4s are on at most 16″ centers and installed properly with sufficient cross bracers, they should be able to support a normal size home ceiling fan (like up to 52″) with a properly installed brace and box.
How do I know if my ceiling box can support a fan?
If the box was installed recently in accordance with National Electrical Code (NEC), the box should be labeled if it's rated to support a ceiling fan.
Can I install a ceiling fan myself?
Putting up a ceiling fan is not a difficult job. Many of the new ceiling fans have an installation hanging hook built into the ceiling mounting. This makes it a one-person job, assuming that you are strong enough to get it up on the hook first.