Before proceeding remove any existing backup file under /home directory using the command below:
rm -rf /home/cpmove-*
Lets create the list of accounts we wish to migrate using the below commands.
cat /etc/trueuserdomains | awk '{print $2}' > /home/accountlist
Suppose that you have 100 accounts and wish to move only 50 account, For this use the command below:
cat /etc/trueuserdomains | awk '{print $2}' | head 50 > /home/accountlist
If we are moving only 50 account use the below steps to create list of another rest of accounts.
cat /etc/trueuserdomains | awk '{print $2}' | tail 50 > /home/accountlist
Now we can create backups of accounts in the list using the below command:
for i in $(cat /home/accountlist); do /scripts/pkgacct --force $i; done
Once backup is created copy the backups to the new server:
scp cpmove-* root@New_server_ip:/home
Now we copy the account list:
scp /home/accountlist root@New_server_ip:/home/accountlist
Now login to the new server
Restore all the accounts using the below command:
for i in $(cat /home/accountlist); do /scripts/restorepkg --force $i; done
Done.