5-minute VPS Migration
Migrating VPSes may be painful, but this method can make it more effective. No addtional software requred, just tar and ssh command. You can move all 5GB data in 5 minites*. (Depend on speed port of your VPSes both sides, also file types).
Source IP: 18.104.22.168
Destination IP:22.214.171.124 (Complte your configuration first, such as LNMP)
Log into source vps via ssh, then enter the dir your directory. Now I want to move mysql data on /var/lib/mysql to new vps with same path.
[email protected]:~# cd /var/lib/mysql
Then type this command:
tar czf - huluwadata | ssh [email protected] tar xzf - -C /var/lib/mysql
[This command means gzipped package is transferred to destination vps while ungzipping by ssh. So, your data is compressed when it's going to be transferred.]
Are you sure you want to continue connecting (yes/no)?
Type yes, press enter.
Warning: Permanently added '126.96.36.199' (RSA) to the list of known hosts. [email protected]'s password:
Type your password, press enter.
Then it's transferd, the only thing you just do is wating.(When display the such as [email protected], complete! )
Ok, let's move my web scripts on /var/www
[email protected]:/var/lib/mysql# cd /var/www
Type following command.
tar czf - huluwaweb | ssh [email protected] tar xzf - -C /var/www
Just do as aforementioned.
[You can move multi files with the command like this
tar czf - dir1 dir2 | ssh [email protected] tar xzf - -C /var/www
At last, you should copy your webserver's conf file and reslove your domain to the new IP.