Solved

Migrate ubuntu server to new hardware

Posted on 2010-11-11
21
1,032 Views
Last Modified: 2012-05-10
I've ubuntu server 9.10 running and has multiple services running on it. I've to migrate this to new hardware configuration. Please guide me.
0
Comment
Question by:Thyagaraj03
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 5
  • 4
  • +1
21 Comments
 
LVL 79

Accepted Solution

by:
arnold earned 250 total points
ID: 34112259
Are you looking to take the drive out and place it in the new system?
Clone the drive using dd.


If this system is active, I'de suggest you install the new version of ubuntu on the new hardware and then configure/copy the data/service from the old.
0
 

Author Comment

by:Thyagaraj03
ID: 34117185
If I clone the drive and connect it to the new system with different hardware configuration, won't it cause any problem as the cloned os will be having previous hardware information(different sizes of ram, cpu of different speed, .....)?.


This way what tool is best for copying and what are the directories I should and shouldn't copy on the orginal system.
0
 
LVL 79

Expert Comment

by:arnold
ID: 34117934
It will adjust.  The only issue you may have will deal with the graphics.  You would likely need to reconfigure XORG. Provided you did not recompile the kernel (create a custom kernel).

As far as what to copy and what not to copy depends on what your intentions are.  Is the new hardware is a direct replacement?

You would/could use DD to copy the partitions and depending on the size could prove tedious.

A clean install of the newer version of Ubuntu and then configuring the server/system to perform the same tasks/service, may be beneficial.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:Thyagaraj03
ID: 34118221
Is the new hardware is a direct replacement?:
Actually to say it's not replacement, but having the old one I want to move entire os to the new computer for better performance with all what are present on the old system.

Clone:
Why not to use 'ddrescue' instead 'dd'?. I tried 'ddrescue' and had the following problem which was not answered by anyone. Actually it's not a problem but need some tricks or tips:
- While using ddrescue, there is a change to wrongly specify devices(/dev/sda /dev/sdb) even checking with fdisk:- Any tricks
- After properly cloning the drives, sometimes the system boots from original disk and sometimes from duplicate after every restart:- Here I need tips/tricks. It should only boot from original disk.
0
 

Author Comment

by:Thyagaraj03
ID: 34118224
I mean to say chance instead change
0
 
LVL 79

Expert Comment

by:arnold
ID: 34121146
You would/should not leave the cloned disk in the system as its presence supposed to be temporary.

I have not seen when the system boots from the clone drive unless your drives are connected out of order i.e. the original drive is connected to SATA 2 and you connected the drive to which you will clone on sata 1 or 0.  When the system booted, it will first detect the cloned drive and boot from it.

It is a good thing to make sure the cloned drive works by at least letting it boot the original system.

Note that if you are using static IPs, you can not have both systems on at the same time.  IMHO, instead of cloning, I would actually install the newer OS anew.  Configure the services/etc. and then when it is ready, will transfer the data from the old to the new.

Presumably you would have to eventually update the 9. to 10. and why not do it where you can test the functionality/configuration without an impact on the current functionality?


0
 
LVL 12

Assisted Solution

by:mccracky
mccracky earned 250 total points
ID: 34121408
Well, it depends a little on what you want to do.  

There is clonezilla for imaging a system (similar to ddrescue): www.clonezilla.org.  
You can do this by setting up a server (http://www.howtoforge.com/cloning-linux-systems-with-clonezilla-server-edition-clonezilla-se) or with the live cd for a system.

You can just use the old school tar to backup/restore your system (Linux isn't windows so file copying is really the same as an image): https://help.ubuntu.com/community/BackupYourSystem/TAR

But, as arnold mentioned, I'd really think of installing new on the system and restoring the services on the new hardware.  At the same time, I'd probably move to 10.04 as it's a "Long Term Support" release where your support will go through at least April or 2013 (or maybe 2015) rather than continuing with 9.10 where support will end in April of 2011.
0
 

Author Comment

by:Thyagaraj03
ID: 34131191
Good answers!. Actually to say, I have to migrate the system to new hardware and as well as I'm working on server recovery project. So for this reason,  I'm even trying to provide High Availability of servers like if any server gets down, I should immediately come up with another with all services

@arnold:
I'm thinking to synchronize two disks after having cloned successfully. If I remove the cloned one, I could not replicate the changes made on the original disk to the duplicate. And one trick I'm expecting from you. That is, if I use dd or ddrescue, I may wrongly specify devices(/dev/sda /dev/sdb) and as for this reason I'm a bit afraid to do so. So any trick here, because I've to do this even for cloud servers.


mccracky:
I can use 'tar' If I'm given extra servers for each and I'm not sure here that I'll have more servers.

I think I cannot use Clonezilla as I'll have to do this for even cloud servers which I will not have direct access to them and I'll connect them via ssh.

0
 
LVL 79

Expert Comment

by:arnold
ID: 34133842
if represents the input file the source and of is the output file or the clone

http://www.ehow.com/how_4924091_clone-hard-drive-linux.html

dd if=/dev/sda of=/dev/sdb
But this will take quite some time depending on the size of the drive.

If you partition the drive to which you will clone the data, you could use the dump | restore mechanism
http://linux.die.net/man/8/dump
http://linux.die.net/man/8/restore

ssh root@oldserver dump -0f /dev/sda1 - | restore rf -

0
 

Author Comment

by:Thyagaraj03
ID: 34134970
Thanks. For replicating, I thought of using rsync and I'm using it, scheduling a cron job without prompting for ssh password.

rsync -avP /usr/ 192.168.2.100:/usr
rsync -avP /etc/ 192.168.2.100:/etc
------------------------------------------
-------------------------------------------

But I'm wondering if it is possible to modify the above entries to one line. And one thing, before doing rsync should I stop all the services?
0
 
LVL 12

Expert Comment

by:mccracky
ID: 34137691
You might be able to combine things into one line with the --include and --exclude options, but another thing would be to (on both machines) use the mount --bind command something like:

mkdir -p /mnt/rsyncmounts/etc
mkdir -p /mnt/rsyncmounts/usr
mount --bind /usr /mnt/rsyncmounts/usr
mount --bind /etc /mnt/rsyncmounts/etc

and then use:

rsync -avP /mnt/rsyncmounts/ 192.168.2.100:/mnt/rsyncmounts/
0
 
LVL 12

Expert Comment

by:mccracky
ID: 34137709
oh, and you shouldn't need to stop any services for these rsyncs.  /etc/ and /usr/ mounts usually aren't changing that much (the /var would be changing much more).  
0
 

Author Comment

by:Thyagaraj03
ID: 34142553
@mccracky:

Wow!. Smart thinking and it's really good to go. I've few questions regarding the following you suggested:
mkdir -p /mnt/rsyncmounts/etc
mkdir -p /mnt/rsyncmounts/usr
mount --bind /usr /mnt/rsyncmounts/usr
mount --bind /etc /mnt/rsyncmounts/etc

1. Would it occupy any extra space(I think yes)
2. Any changes made to ' /mnt/rsyncmounts/' are replicate to the original directories /usr, /etc, ...?----I feel it would be better if it has one way sync. Like,
any chnages made to /mnt/rsyncmounts/ SHOULD'NT be replicated under / directories AND
any changes made to / SHOULD be replicated to /mnt/rsyncmounts/. Any tips here?
0
 

Author Comment

by:Thyagaraj03
ID: 34144607
Ok. How to unbind /mnt/rsyncmounts/*
0
 
LVL 12

Expert Comment

by:mccracky
ID: 34145527
Any changes to the files under the bind mounts would be replicated as it is just a duplicate inode to the same file.  They actually are the exact same files under /mnt/rsyncmounts as under the /etc and /usr directories.  This also means that is doesn't occupy any extra space at all.

If you want the replication to be one way, then you would need to copy the files rather than mount --bind them and that would occupy extra space and another level of rsync commands. Once again, the mount --bind just adds another reference to access the files.  They are the exact same files.

unmounting should just be a:

umount /mnt/rsyncmounts/usr
umount /mnt/rsyncmounts/etc
0
 

Author Comment

by:Thyagaraj03
ID: 34151854
Before asking I tried umount but it said it cannot be unmounted. I think I was in that directory.
0
 

Author Comment

by:Thyagaraj03
ID: 34151911
One more thing if I use 'tar' or 'rsync' , will the iptable rules applied to the source are also applied to the destination?
0
 
LVL 12

Expert Comment

by:mccracky
ID: 34154292
re: umount:  umount will always fail if part of the partition is in use (when you are in the directory it is "in use").

re: iptables: it depends how you apply the rules in the first place.  It probably will as both the start up scripts and configuration files are usually somewhere under /etc.
0
 

Author Comment

by:Thyagaraj03
ID: 34161017
mccracky: Thanks a lot. I'm not using any iptables startup script but I checked applying iptable rules on source, then creating a tar and extracting it on destination. The destination has default rules. It's ok here.

As Arnold suggested would you like to suggest any more way or tool other than tar and rsync for migrating ubuntu cloud servers remotely
0
 
LVL 88

Expert Comment

by:rindi
ID: 34978022
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

CHALLENGE LAB: Troubleshooting Connectivity Issues

Goal: Fix the connectivity issue in the lab's AWS environment so that you can SSH into the provided EC2 instance.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question