I plan to buy a used Mac Mini from 2011. I am a bit worried about getting a second-hand Mac Mini since there might be some virus on the Mac Mini and hence lose all of my data. Thus, upon purchase, I plan to replace the hard drive with what I already have. However, since I do not have access to any other macOS, I will not be able to make a recovery disk using a USB stick.
I read that Mac Mini has a Recovery Mode that allows reinstalling macOS if the Mac Mini is connected to the internet. Where are the recovery files located? Are they on the hard drive themselves? If yes, then I am worried upon replacing the hard drive I cannot reinstall the OS.