Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My company needs to setup a development server and we already have 2 production RHEL 6 servers working under a L4 switch.

One of the solutions to setup the dev server was to simple copy all files from one of the production servers and tweak it a little.

I've never done it before but it sounds similar to ghost imaging... can it be done? Is it recommended? Would it be prone to errors?

share|improve this question

4 Answers 4

up vote 7 down vote accepted

Copying all of the files could work. It's going to depend on the OS and what kind of copy method.

One general problem is trying to copy the system while it is running. Typically at least some of the files will be locked, and therefore won't copy correctly. Using some kind of imaging software while the system is shut down is usually safest (you mentioned Ghost which is one example)

share|improve this answer
It's RHEL6. Can it be done? –  dK3 Aug 22 at 19:00
RSYNC is designed for mirroring and available on just about any system. You can use that. –  Jeff Clayton Aug 22 at 19:18
Sounds good thanks :) –  dK3 Aug 22 at 19:26
What do you mean by "locked"? That's a fairly Windows view of things. The usual issue with copying a live FS in UNIX is that files change underneath you while they're being copied. –  MadHatter Aug 23 at 20:11
...an issue which can be avoided with systems using LVM by using LVM snapshots to take a consistent image of the underlying block device and duplicating that, rather than running copy operations at the filesystem level. –  Charles Duffy Aug 24 at 17:24

Why not convert the running systems to Virtual Machines? Most hypervisors like VMware or Hyper-V have a tool to convert a running system to a virtual machine easily.

You can then work with a non-production system as you wish before doing anything on a production server.

Thanks to @WernerCD



share|improve this answer
I'm afraid that kind of modification is out of the picture... –  dK3 Aug 22 at 19:27
@dK3 I think you misunderstand. You wouldn't be modifying the production servers (unless you want to). You'd be installing a small tool on one of the production servers to let your VM solution "explore" it and create an image of it. You install the VM solution on your development box and point it at the "converted" image of your prod server. So, if you don't already have a development environment, this solution isn't a "change" ... –  svidgen Aug 22 at 19:34
Google P2V Physical to Virtual -- Vmware: my.vmware.com/web/vmware/evalcenter?p=converter - HyperV: social.technet.microsoft.com/wiki/contents/articles/… - Virtualize, backup, isolate (so if it's pointing towards a production database) and then have fun –  WernerCD Aug 23 at 2:57

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.

share|improve this answer
copying a system via a backup restoration...probably the best because it accomplishes multiple goals... –  Bart Silverstrim Aug 23 at 1:49
I would add that mounting a development system from scratch may be a good way to check the system documentation. If it happens that mounting such a server cannot be done with the documentation at hand, you have discovered an issue which might be critical to the production system (if you ever need to migrate it, or install the system for another branch, or do disaster recovery). –  SJuan76 Aug 23 at 18:23


Sure, it's possible, because it's not hard to "install" Linux using unconventional means. You could, for example, replicate the server using rsync over SSH.

  1. Boot the target machine into a "rescue" image, whether using a Red Hat DVD, Ubuntu live boot, Knoppix, whatever.
  2. Partition and format the target machine, and mount the filesystems under a /target.
  3. rsync all relevant filesystems over SSH (skipping /proc, /sys, swap).
  4. Fix up /target/etc/fstab, especially if the partitions are referred to by UUID.
  5. Tweak hostname and network configuration as appropriate.
  6. Install the boot loader.

Step 3 could consist of multiple rsync passes, possibly aided by LVM snapshots on the source machine, the last pass with all services on the source machine stopped to ensure data consistency.

Desirability and best practices

Just because you can doesn't mean you should. I've recommended the process above as one way to do a data center migration. However, your use case is quite different. Resorting to cloning highlights some deficiencies:

  • Virtualization would be a nice capability to have, and would make replication easy.
  • Do you have backups of your production server(s)? Why not just restore them? This would be a good test of your backup restoration procedure.
  • Do you have documentation of how to reproduce everything from scratch? Eventually, you will probably need to install from scratch, perhaps when you upgrade the operating system. This would be good validation for your documentation.
  • Better yet, do you have automation that helps you reproduce your setup? A shell script could work; a configuration management solution such as CFengine, Puppet, Chef, or Ansible would be even better.

If you blindly clone the production server, you'll lose a valuable opportunity to clarify exactly what is running on it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.