LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to copy entire contents from existing Linux server to new PC (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-copy-entire-contents-from-existing-linux-server-to-new-pc-4175422461/)

okorkie 08-16-2012 01:51 PM

How to copy entire contents from existing Linux server to new PC
 
Hello,

I'm done a few searches and I'm having difficulty figuring out which is the best way of accomplishing my goal. I'm trying to take an old stand alone linux server and copy the entire system (possibly called mirroring) to a new and separate PC which is running Windows (I am ok with completely overwriting the contents of the Windows PC with the contents from the Linux box).

The system I want to copy is currently:

# cat /proc/version
Linux version 2.6.18-92.1.18.el5 (mockbuild@builder16.centos.org) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Wed Nov 12 09:30:27 EST 2008


# fdisk -l

Disk /dev/hda: 30.7 GB, 30738677760 bytes
255 heads, 63 sectors/track, 3737 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 3640 29133877+ 83 Linux
/dev/hda3 3641 3737 779152+ 82 Linux swap / Solaris


# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 27G 1.4G 25G 6% /
/dev/hda1 99M 11M 83M 12% /boot
tmpfs 125M 0 125M 0% /dev/shm

Does anybody know the best way to go about this? Do I need to remove the Windows hard drive and install it into the Linux box (I would rather not have to do this if I can avoid this). Can this be done via cross-over ethernet cable between the 2 devices?

Thanks in advance!

frieza 08-16-2012 02:01 PM

i would install the same distribution on the target system as the new systems, install the same packages as exists on the existing server, make sure both installs are up to date, create any users from the old system on the new system, then copy /var, /etc/ and /home, making sure to chown the individual home directories to the new uids on the new system. only those folders for the most part contain information that can be altered by users/administrators/software (for instance mysql is /var/lib/mysql, and apache is /var/www{/html} by default), the rest is stuff that comes from packages and isn't altered except by a software update.

zedmelon 08-16-2012 02:08 PM

The word "best" can get you a hundred varied responses, but what I'd do is tar the entire thing for easier copying. You might take manual steps first to put things like crontabs in more friendly locations, but that's just preference (see above).

Next I'm assuming you mean the Windows box will take over the function of your current Linux system. If that's correct, there's no need to swap hardware. I'd wipe the Windows drive and give it a fresh Linux install--same distro is probably preferred--then copy the tarball to the new system in a backup directory, ready to cherry-pick individual files, such as httpd.conf, dhcpd.conf, et cetera. Keep in mind whether any file's ownershit is relevant to its function--serving web pages from user home directories and such.

Since the current Linux box is significantly older, you'll want to be very careful about dropping configuration files into a newer environment. Applications change, and the old config might not work anymore (Nagios comes to mind).

This is where you stand to perform more manual conversions and potentially wonder if the backup was worthwhile, or if it would've been easier to simply recreate everything from scratch. Only you can decide that, based on your familiarity with configuring whatever will run on the box. Of course served content and media archives are exempt from that part.

Good luck!

zedmelon 08-16-2012 02:12 PM

Hahahah, naturally I meant "ownerSHIP," but that typo is funny enough to leave alone.
;-)

I also forgot to mention that if all you need is to back up your existing box for safekeeping, you can copy the tarball to your Windows box with PSCP.

chrism01 08-16-2012 06:06 PM

If the HW is the same, you can use http://www.mondorescue.org/ or Clonezilla or hot-swap/mirroring if you have already got the capability.
Otherwise, re-building the OS separately, then copying over the Apps/data will probably do.
Definitely take a couple of backups first.

okorkie 08-17-2012 10:15 AM

Thanks everyone.... It sounds like it is easiest to start from scratch and maybe update the distro while I'm at it.

Cheers


All times are GMT -5. The time now is 04:03 AM.