Presuming some kind of linux/bsd, it's actually possible to copy a 'running' system over to another one. The target is strongly recommended to be booted in something other than the systemdisk (rescue system, or swap partition with mini system installed).
The advantage of this approach is all kinds of settings are identical (permissions, user crontabs, web server library versions, ...). Of course you also copy over all the cruft that has built up as well.
First turn of everything holding important data or not strictly required (database, http server, all kinds of daemons etc).
You can then tar / and copy it over, install the bootloader on the target system.
Any running daemons may think the system crashed, but it should be no worse than pidfile overrides.
- start the whole operation from a screen or use nohup.
- Pipe the tarball over ssh:
root@source:~# tar czvf - / | ssh root@target "tar -xzv -C targetpartition/ -f -".
- Preferably umount any data partitions and give them a seperate treatment. Keep in mind the mountpoint (underlying the mounted fs) may have had files.
- Carefully check hardware configuration, bootloader config, fstab and ethernet config (nothing worse than a successful conversion that's unreachable from the internet because eth0 and eth1 are switched arround)
- Make sure tar takes over uid/gid/permissions and extended attributes (if any). Requires root on unpacking, hence the ssh root login in my example.
- It is a lot easier if you have a remote reset and rescue system on the target. If things don't work out at first, you can check the syslog for errors etc.
- Don't do this under time pressure or substance influence ;-)