How to sync data between old and successor server?

postcd

Well-Known Member
Oct 22, 2010
717
19
68
Hello dear support a members,

i plan to copy my cpanel users accounts from one WHM v74 virtual server (which i will be deleting) to another WHM v70+ virtual server on which most of these cpanels already exist (this VPS server is restored from backup and i want it that way), both VPS running on same dedicated server. The process of all cpanels migration via WHM can be very slow in my case (i have very slow HDD regarding IOPS) causing unacceptable downtime and also my new server will have same IP as old one. So i am thinking if i can save resources and minimize downtime by backing up and restoring using /scripts/restorepkg the way that it will not overwrite already existing users files, but only write new and changed ones. If that is not possible, i would have to delete all cpanels on destination and do standard /scripts/pkgacct & /scripts/restorepkg betweens servers for all cpanels.

But before the backup & restore is finished, the source server files and mysqls will get updated by websites visitors in the meantime, which means i will need to run continuous rsync on files between live and successor server and then write and run script to backup mysqls, set them as read only on source, restore/replace mysqls on destination server and stop files rsync & switch server IPs.

1. rsync files, i found following command:
rsync -aqHl -e ssh /home/* [email protected]:/home/

Here i have doubt about following files/folders:

drwxr-xr-x 5 root root 4096 Apr 22 2014 .cpan/
drwxr-xr-x 3 root root 4096 Oct 8 2017 .cpanm/
drwx------ 3 root root 4096 May 3 04:36 .cpcpan/
drwx--x--x 13 root root 4096 Jul 13 22:55 virtfs/

I know virtfs is somehow essential for work - VirtFS - Jailed Shell - Version 68 Documentation - cPanel Documentation . I maybe have enabled shell access to some accounts, but it is no longer needed and i do not plan to have users with shell access. Should i sync all four folders mentioned above or i need to skip them? I see that only updated folder in virtfs is virtfs/username/etc

2. backup mysql's (mysqldump), set them as read only on source server, restore mysqls on second server, switch IP from old server to second one.

This way i would cause maybe 10 minutes of downtime (very slow HDD) where people will be unable to write new data to databases, i assume.

Thank you very much in advance for the feedback regarding virtfs, rssyncing and low downtime migration
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,229
463
Hello @postcd,

First, I wanted to point you towards an existing thread with information you may find helpful:

Possible to upgrade CentOS 6.5 to 7 without total rebuild?

Here i have doubt about following files/folders:

drwxr-xr-x 5 root root 4096 Apr 22 2014 .cpan/
drwxr-xr-x 3 root root 4096 Oct 8 2017 .cpanm/
drwx------ 3 root root 4096 May 3 04:36 .cpcpan/
drwx--x--x 13 root root 4096 Jul 13 22:55 virtfs/

I know virtfs is somehow essential for work - VirtFS - Jailed Shell - Version 68 Documentation - cPanel Documentation . I maybe have enabled shell access to some accounts, but it is no longer needed and i do not plan to have users with shell access. Should i sync all four folders mentioned above or i need to skip them? I see that only updated folder in virtfs is virtfs/username/etc
There's no need to synchronize those directories as they do not contain account-specific data. These directories will automatically generate when necessary. The virtfs directory is setup automatically when needed and you should never manually modify or remove the contents of that directory. You should exclude it from the rsync command per the instructions noted in the thread I linked to above.

Thank you.