copy cpanel account without much free space

guarez

Active Member
Jul 27, 2020
33
4
8
Chile
cPanel Access Level
Root Administrator
Hi, I am trying to use the functionality to copy a cpanel account from a remote server to the new server.
I wanted to know what requirements the remote account should have, specifically for the hard disk space, for example, the remote account has 5GB of capacity, and is using 4.5 GB. Is it possible to use the account copy functionality? I understand that it first makes a tar.gz and then copies it. How can I copy that account in another way?
 

vacancy

Well-Known Member
Sep 20, 2012
566
226
93
Turkey
cPanel Access Level
Root Administrator
In this backup, firstly files and database are collected in a temporary folder, then they are compressed and transferred to the opposite server. So you will need as much space as the site is using, or even a little more.

If you can define an additional disk space on the server, you can add this space as home2 and move the site to this area and then try to transfer.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,512
2,606
363
cPanel Access Level
Root Administrator
If you have root access to both systems you can do the following:

Code:
/scripts/pkgacct --skiphomedir
This will create a package without the user data from /home/username. It will still create databases, database content, email addresses and password (no content though), and enough details to make the cPanel account on the new system. You can then move that package file, which will be located in /home and named cpmove-username.tar.gz over to the new server and restore it.

After that, you can rsync the content of /home/username between the two systems.

As long as most of your content isn't in databases, this is a good way to move data when you are short on space.

More details on flags for pkgacct can be found here: The pkgacct Script - Version 84 Documentation - cPanel Documentation
 

GoWilkes

Well-Known Member
Sep 26, 2006
703
34
178
cPanel Access Level
Root Administrator
I went through a similar process recently... the best solution I could find was to use rsync and bypass cPanel entirely.

My notes:

Code:
-z                    enable compression (increases server load, so maybe not use on first run)

-v                    verbose

-r                    recursive (not necessary if you use -a)

-a                    archive; automatically uses recursive mode and preserves symbolic links, permissions, timestamp, owner, and group

-u                    update; do not overwrite a file at the destination, if it is modified at the destination

-R                    --relative, maybe use to create full directory tree? I'm not sure, something about using a . as an anchor somewhere.
                       Otherwise, though, you have to create the directories manually

-pog                preserve permissions, owner, group  (not necessary if you use -a)

--dry-run            also -n; I haven't used it, but it let's you "double check your arguments before executing"

--progress            displays detailed progress of rsync execution

--exclude            optionally exclude a directory or file; eg, --exclude 'foo' --exclude 'bar' /home/example/www
                            alternative, --exclude={'foo','bar'} /home/example/www
                            pattern, --exclude '*.jpg' /home/example/www

-e 'ssh -p 1234'    specify port if different from regular port


## Actual usage, where --progress, -e, and --exclude are optional:
# rsync -avu --progress -e 'ssh -p 1234' --exclude={'foo','bar'} [email protected]:/home/old_account/www/ /home/new_account/www/

(When you submit, it will ask for Password for the old server)
I'm pretty sure there's a modifier you can plug in to automatically delete the file from the source once it's copied, but that's just playing with fire...