Can it be done?
Definitely yes. I have copied an entire Linux server by simply packing up the files with tar
and extracted them again on the target server. The only caveat I recall was having to remember to use --numeric-owner
when extracting. I can't speak for other OS and other tools, but I imagine it is doable with all major operating systems.
Should it be done?
This question is a bit more complicated to answer. I won't recommend simply cloning a production system for the purpose of development. It may very well contain lots of user data as well as key material, which you do not want to have present on development systems.
But cloning your production system can be a good idea for other purposes.
The approach I would recommend for creating a clone of the production system is to restore from backup. You can avoid performance impact on the production system by restoring from a backup, and you get to test your restore procedure, which is a good thing.
It is important to keep the clone you restored from backup isolated from the rest of the world. Since it was restored from a backup of a production system, it may contain automated jobs, which will communicate with other production systems, and it will have the credentials to do so.
You could potentially cause much damage, if the clone got to communicate with real production systems.
But if you keep it isolated, it gives you opportunity to test that the restored system works as intended. Moreover such a restored system could be a useful environment for the last test of new code before it is deployed to production. This may be your only opportunity to test the code on real user data, before it is actually in a position to break the production system.