Transfer Ubuntu server to new hardware

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Transfer Ubuntu server to new hardware

Postby ollie » Wed Nov 07, 2012 12:25 am

Hi all,

I've been away from the forums for a long time because of work pressures and illness :( but I'm back for some advice.

I'm moving an existing Ubuntu Server 10.04.4 LTS amd64 server to new hardware. I have tried installing Ubuntu Server 12.04.1 LTS onto the new hardware and started using rsync to copy over home directories, web server files and some configuration files. I used mysqldump via ssh to copy all of my databses over successfully, including all all of the MySQL users and permissions.

However, I'm having problems restarting the Apache web server with missing configuration files. I'm also not sure if I've got all of the required PHP5 configuration files. There seems to be some differences between the configuration of Apache on 12.04 and 10.04.

I'm starting to realise that moving the server onto a different server version may not be a good idea :oops:

So here's the big question, if I install Ubuntu 10.04.4 LTS onto the new server and run:
Code: Select all
#mysqlpdump --user=root --password="securePassword" --all-databases | ssh root@192.168.0.35 'mysql --user=root --password="securePassword"'

then
Code: Select all
#rsync -avz / --exclude '/var/mysql/*' | ssh root@192.168.0.35:/


Would I be copying an entire system and overwriting the default files and settings entirely, including passwd and shadow files?

I could then do a running system upgrade to Ubuntu Server 12.04.1 LTS and be happy on the new hardware :D
User avatar
ollie
Moderator
 
Posts: 2749
Joined: Mon Jul 25, 2005 11:26 am
Location: Bathurst NSW Australia

Postby Dutch_Master » Wed Nov 07, 2012 2:03 am

You can copy the package list with:
Code: Select all
dpkg --get-selections > selections.txt
Copy the lot over (including the sources.list) then, after you've put the sources.list back in place, execute the following one-liner (as root, obviously):
Code: Select all
aptitude update && aptitude install dselect && dpkg --set-selections < selections.txt && dselect install
Make sure you have the correct path to the selections.txt file! (right, Ubuntu doesn't use root, it insists on sudo :roll: Oh well, you know what to do then ;))

This way you should have the entire environment you were working on back on the new server.

Another option to move the lot is making use of RAID: add a few disks to the existing machine, then mirror the new disks (as RAID1) to the old RAID. The kernel will then rebuild the new RAID (i.e. make a 1:1 copy of the old system), which then can be transferred to the new server. Takes time (few hours for a 500 GB disk) so best done overnight. Theoretically it works...
Dutch_Master
LXF regular
 
Posts: 2452
Joined: Tue Mar 27, 2007 1:49 am

Postby ollie » Wed Nov 07, 2012 3:27 am

Thanks DM - you've confirmed the process that I'm doing for the environment. I'm just waiting to install the "extra" software I've added to /etc/apt/sources.list like Webmin & MondoRescue. I actually used dpkg and apt-get because it's only 4 commands including the fetching on the new server:
Code: Select all
wget http://oldserver/installed-software.txt
sudo dpkg --set-selections < installed-software.txt
sudo apt-get update
sudo apt-get upgrade

Then it will be doing the MySQL dump, which I know works, and then trying to rsync everything else in one go.

I'm just worried about the final rsync being able to write all of the files to a running system, which will get all of the IP address and name settings of the old server. Will rsync overwrite /etc/passwd and /etc/shadow successfully?

I can't go the RAID route, the old server has 2 x SCSI 3.5" hard drives in RAID1, whilst the "new" server has 8 x 2.5" SAS drives that I've broken up into 2 x RAID1 (/boot, /, swap), 3 x RAID5 (/var) and another 3 x RAID5 (/home).
User avatar
ollie
Moderator
 
Posts: 2749
Joined: Mon Jul 25, 2005 11:26 am
Location: Bathurst NSW Australia

Postby Dutch_Master » Wed Nov 07, 2012 7:23 pm

Can't help on MySQL Ollie, but welcome back anyway ;) It's generally not a good idea to replace critical/essential files on a running system, perhaps a live-cd/usbstick would be a better idea. Make sure you copy the to-be replaced files for easy restoring if things go haywire!
Dutch_Master
LXF regular
 
Posts: 2452
Joined: Tue Mar 27, 2007 1:49 am

Postby ollie » Wed Nov 07, 2012 9:55 pm

Thanks DM.

Now I'm wondering if I shut down the Apache & MySQL servers on the target system, as well as any other servers other than OpenSSH, and then do the rsync if that would be more successful.

I'm making sure I don't wipe anything on the old system until the new server is totally functional. It is also backed up to tape drive, just in case.

I'm not sure if I'll be trying on Friday, when I can take the old system "offline" for a while, or waiting until December when the system can be offline for a week during a shut down period.
User avatar
ollie
Moderator
 
Posts: 2749
Joined: Mon Jul 25, 2005 11:26 am
Location: Bathurst NSW Australia

Postby Dutch_Master » Thu Nov 08, 2012 2:09 am

Plan for next Friday, then you have a week fall-back time to fix errors. The initial rsync is the largest, perhaps use tar to compress the lot? But! You have a backup (of the old system), why not use that to roll data in instead? No chances to compromise the old system, and you get to check your backup roll-back strategy is working :D

As for the tape drive: unless your client is emotionally very attached (sic :P) to that ancient device, advise them to switch to Blu-Ray instead ;)
Dutch_Master
LXF regular
 
Posts: 2452
Joined: Tue Mar 27, 2007 1:49 am


Return to Help!

Who is online

Users browsing this forum: No registered users and 0 guests