LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-14-2017, 11:01 PM   #1
Nitup
LQ Newbie
 
Registered: Dec 2014
Posts: 13

Rep: Reputation: Disabled
Full clone of running Linux Server (Centos7)


I need to create a completely identical linux system on another machine.

Now I have a linux server up and running with Centos 7 installed. It acts as a server for some web resource. Also it runs in a KVM virtual machine. So I have no chance to boot from a livecd anyway.

I can't stop my system as well, only for a couple of minutes, but this won't help anyway.

So my question is how to create a complete clone of running system.

I have the following disk layout

Code:
/dev/mapper/VG-lv_root 100492376 21506376  73858220  23% /
devtmpfs                 1930476        0   1930476   0% /dev
tmpfs                    1941024        0   1941024   0% /dev/shm
tmpfs                    1941024    57980   1883044   3% /run
tmpfs                    1941024        0   1941024   0% /sys/fs/cgroup
/dev/sda1                 499656   201976    271468  43% /boot
overlay                100492376 21506376  73858220  23% /var/lib/docker/overlay/2a5e41fa94f64ffefaaa4a644cb8413e1579d877e35187bae2cf38772acbdb1a/merged
shm                        65536        0     65536   0% /var/lib/docker/containers/5c831624ff9e4d0dbcdf73120df94a601f0a29cb34716d5c7906ef29d778c938/shm
overlay                100492376 21506376  73858220  23% /var/lib/docker/overlay/3d904f042dc29ac06871cd301b89c4c8fadd254fe24855369279b5df0343968c/merged
shm                        65536        0     65536   0% /var/lib/docker/containers/e20b5a4bcce42d6a8d33ae7e66e33150782960b60babf65d699c52c4ba7ae24f/shm
tmpfs                     388208        0    388208   0% /run/user/0
tmpfs                     388208        0    388208   0% /run/user/1001
I want to clone this system into another machine that is a KVM as well. I am running Proxmox on my home server. So I have any kind of access to this machine.

Please suggest how to create a complete clone in this case ?

Thanks
 
Old 09-15-2017, 03:52 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
If it's a virtual machine then just take a snapshot of the machine and clone it from the snapshot.
 
Old 09-15-2017, 08:50 AM   #3
Nitup
LQ Newbie
 
Registered: Dec 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
I cannot create a snapshot as far as I don't have access to the hypervisor, I am using VPS hosting and have only access via SSH/VNC.

Could you suggest the best choice in this instance.
 
Old 09-15-2017, 09:02 AM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Install a new machine with Centos 7. Make sure your GRUB and kernel are identical. If you use the same installation as the original machine and you did not upgrade the original machine this will be the case.
Install rsync on both original and copy if it is not installed yet.
Make sure your copy will boot and has SSH root access.

Rsync the original machine to the new machine:
rsync -av --exclude='/proc' --exclude='/sys' / ip.copy.machine:/
Issue this command as root from the original machine.
Doublecheck if you are on the original and doublecheck the command line. The source '/' must come before the destination 'ip.copy.machine:/'.

After copy is complete, on the copy find in the udev config directory 70-persistent-net.rules and delete the line describing you primary network interface. It will be recreated. I don't know what the udev config directory is in Centos.

If fstab uses uuid to mount volumes, check the uuid of the volumes on the copy using blkid. If the uuid's are different, edit fstab to create the correct devices to mount.

When this is done, reboot the copy.

If you have databases running on the original, either stop the database. Or make a database dump before the rsync action. After the copy is up and running, restore the database from the dump.

jlinkels

Last edited by jlinkels; 09-15-2017 at 09:06 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have virtualbox running on centos7 now... sigint-ninja Linux - Newbie 3 04-22-2015 07:10 AM
LXer: Free Red Hat clone CentOS-7 is full of Linux Container love LXer Syndicated Linux News 1 07-07-2014 10:00 PM
I need to Clone a Red Hat drive and install clone in HP server drummer54 Linux - Newbie 14 03-07-2009 04:15 PM
Best Way To Clone A Running Server? hurt138 Linux - Software 8 01-05-2007 02:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration