Migrating a users and files to a new Linux Box

Posted Tuesday, March 17th, 2009 at 11:14 am

The purpose of this article is to show you how simple it is to migrate your system to a new server in case you have a need to upgrade. This is not for the people that are not familiar with Linux. You need to know, for example, that if it is a web server, make sure you get the Apache configs. I wanted to move users, passwords, samba users, samba passwords and home directories to the new box. Here is what I did.

This tutorial should work for any version of Fedora, and really, should work for Linux boxes in general. This should teach you the concept more than anything.

Box 1: This is the original box that I setup a long time ago. It is running Fedora Core 6, with the latest updates. The IP of the box is 192.168.0.11. I transferred users, passwords, groups, Samba configs and users’ home directories from this box

Box 2: Fresh (very simple) installation of Fedora Core 6 with the latest updates. I installed Samba, if you need Apache, go ahead and install that on the new box. Make sure you have the latest updates on both! Give it whatever IP address, I used DHCP and it got 192.168.0.115.

DO NOT CREATE A USER (besides root) ON THE NEW BOX and once your new box has installed Fedora, do not login (might be overkill, but I would take the chance.

Let’s start:

Move users/passwords/groups/shadow/Samba configs to the new box:

tar -cf – /etc/passwd | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/passwd- | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/shadow | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/shadow- | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/group | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/group- | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/sudoers | ssh 192.168.0.115 tar -xf – -C /

tar -cf – /etc/samba | ssh 192.168.0.115 tar -xf – -C /

Now copy over users home dirs (It can take hours depending on amount of data):
tar -cf – /home | ssh 192.168.0.115 tar -xf – -C /

Now copy over root’s home dir if you want:
tar -cf – /root | ssh 192.168.0.115 tar -xf – -C /

That’s it. You don’t even need to reboot.

Now grab whatever configs you think you will need. Do not toss that old box….keep it around for a while. You want to make sure that you have all of the files off that you need. You might need your Apache configs, php.ini, and /etc/hosts.

Now change your IP address of your new box to what your old box was. In *theory* no one will tell the difference, except file transfers will be faster.

Feel free to contact me if you want

Post to Twitter  Post to Digg

 


Filed under: Linux/Unix, Operating Systems
This comments feed:RSS 2.0
You can leave a response, or trackback from your own site.

Leave a Reply

 
Theme by A. Reimann