Find the answer to your Linux question:
Results 1 to 9 of 9
Hi all, I've been asked to look into moving the contents of 1 linux server which has samba, php, mysql, apache and some other bits installed, to a brand new ...
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    1

    Smile Copy linux setup from 1 box to another.

    Hi all,

    I've been asked to look into moving the contents of 1 linux server which has samba, php, mysql, apache and some other bits installed, to a brand new server which currently only has the os. Is there an easy way of doing this by copying the files/directories straight over or would we need to build all the software from fresh again on the new box? They are both on different IPs so I'm guessing I'd need to update some configs and if I can avoid taking the current box offline then that would also be useful.

    I'm fairly limited in my linux knowledge so any help is appreciated.

    Thanks in advance.

  2. #2
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,095
    Hello and welcome!

    One of the easiest ways to migrate to another machine is to create a system image of the current system, then restore that image to another machine. There are a number of different applications that can do this, including Clonezilla, FSArchiver, Ghost4Linux, Mondo, and PartImage, or you could use the dd command. Each of these have pros and cons associated with them so you'd need to determine which if any would best suit your own purpose for using it.

    Maybe some of the others here will offer up additional suggestions.
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  3. #3
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,096
    Hmm, imaging seems overkill to me.

    Is the old server set up by using packages only,
    aka: no sources manually compiled?
    If yes,
    - make a list of the installed packages
    - install the same on the new server
    - then copy and modify (IP, hostnames, etc) the config files for apache, samba, etc
    - then copy the data over with rsync
    - test
    You must always face the curtain with a bow.

  4. #4
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    623
    Ozar and Irithori both make good suggestions. Imaging will ensure complete fidelity to the original server without having to understand all of its intricacies, but will certainly require taking the existing server offline, and may not be appropriate to taking full advantage of the new hardware. If there's a lot more disk space on the new server, you might need to jump through some serious hoops in an image scenario. And if it's a 32bit to 64bit OS migration, it wouldn't work for you.

    Irithori's laundry list for a parallel migration is pretty good. I've done this type of migration many times, and if you follow those steps and test the new box appropriately, you can then do a cutover by having the new box assume the old one's IP and hostname after a final rsync of the data with the services on the old box shut down. Rsync is definitely your best friend in this scenario. BUT, in order to do a migration like this, you have to develop a full understanding of all of the services/configurations you're replicating.

    Good luck!

  5. #5
    Just Joined!
    Join Date
    Mar 2010
    Posts
    1
    There are many solutions, but that basically depends on how different the 2 machines are (will be).

    Do you want to keep the same distribution / version?
    If you only want to migrate from 1 to the other with no modification I'd suggest the following (but you need to know the distribution used pretty well):
    - Take a live-cd and boot the new machine.
    - Partition it to your needs and format the filesystems.
    - Then mount them in the /mnt (or whatever) in the same order you will be mounting them when it starts up.
    - enter the /mnt and use rsync to copy over everything to the /mnt
    - chroot into /mnt and do the appropriate changes (hostname / modules / fstab) if needed (this is the most triky part as you need to know what you are doing.
    - install the bootloader (grub)
    - exit the chroot / umount the partitions and reboot
    - If you want to test, first be sure to have changed the Ip address
    - The you can run rsync again to align the eventually modified files (i.e. mysql).
    - You'll need to have some downtime if you use anything that changes during time, but it will be pretty fast to rsync again only thoose parts

  6. #6
    Just Joined! its_really_me's Avatar
    Join Date
    Mar 2010
    Location
    Germany
    Posts
    24
    I've doen it many times. I used clonezilla from a USB stick to copy partitions from one disk to another but you need to take care that you do not mess up with partition labels, i. e. if you already have a partition labeled as /, a new one might be renamed and so booting from it fails. Also, if you decided not to copy the MBR / bootmanager you need to fix it manually. So I installed the OS just again and copied directories and files with cp -a
    rsync is a good alternative but you can also try GUI enabled software like Goodsync and Dropbox.

  7. #7
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,095
    Quote Originally Posted by Irithori View Post
    Hmm, imaging seems overkill to me.
    Right... it might be overkill, but the real advantage to cloning is the speed in getting the job done.

    I can clone my own system to another drive in around 6 minutes, and that includes imaging the first system and then restoring it to the secondary system. I'd think that should prove to be much faster than most any other method of migrating to another machine. Of course, if time is of no concern then speed doesn't matter.

    Redlorry, do let us know how it goes with whatever route you should choose.
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  8. #8
    Linux Engineer nujinini's Avatar
    Join Date
    Apr 2009
    Posts
    1,229
    Hi!

    If I may ask, can the OP use MC to do the job for this particular task?
    nujinini
    Linux User #489667

  9. #9
    Linux Enthusiast Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    717
    Quote Originally Posted by nujinini View Post
    Hi!

    If I may ask, can the OP use MC to do the job for this particular task?
    MC can help you with the copying task. It is merely a file browser with lots of features.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...