Change cpanelpkgrestore.TMP.work directory
Hi,
I'm restoring a cPanel account backup stored in compressed format.
During the restore process, cPanel first extracts the backup into a temporary directory under:
/backup/YYYY-MM-DD/accounts/cpanelpkgrestore.TMP.work.xxxxx
and only afterwards moves the files to their final locations.
The problem is that this temporary extraction requires additional free space on the backup destination filesystem, and in my case there isn't enough available space to hold both the compressed archive and the fully extracted contents at the same time.
While troubleshooting, I found the following in /usr/local/cpanel/logs/backup_restore_manager_error_log:
ERROR: Account Restore Failed: Failed to extract the archive at
"/backup/YYYY-MM-DD/accounts/account.tar.gz"
...
/bin/gtar --extract --directory
/backup/YYYY-MM-DD/accounts/cpanelpkgrestore.TMP.work.xxxxx/unsafe_to_read_archive
--file /backup/YYYY-MM-DD/accounts/account.tar.gz
...
From the log, it appears that Account Restore is extracting the archive into the cpanelpkgrestore.TMP.work.xxxxx directory located on the same filesystem as the backup.
If I manually run the extraction command and change the destination directory to another filesystem with sufficient free space, the extraction completes successfully:
mkdir -p /backup-staging/YYYY-MM-DD/accounts/cpanelpkgrestore.TMP.work.xxxxx/unsafe_to_read_archive
/bin/gtar --no-same-owner \
--use-compress-program=/usr/local/cpanel/bin/gzip-wrapper \
--preserve-permissions \
--extract \
--directory /backup-staging/YYYY-MM-DD/accounts/cpanelpkgrestore.TMP.work.xxxxx/unsafe_to_read_archive \
--file /backup/YYYY-MM-DD/accounts/account.tar.gz
Is there any supported way to change the temporary working directory used by restorepkg / Account Restore so that archives are extracted on another filesystem?
Any configuration option, environment variable, or supported workaround would be greatly appreciated.
Thanks!
-
Hey there! I don't believe this is currently an option. This is why we've traditionally told users you need 2x + 1G of space in order to perform a restore while it does the unzipping and temporary files.
Would you like me to create a feature request for this one?
0 -
Submitted. Thanks Mr Dinosaur.
PS: this would be much more NFS-friendly. Many environments store backups on NFS mounts, and extracting large archives directly on NFS can be significantly slower and generate unnecessary network I/O. Allowing temporary extraction on a local filesystem would improve restore performance and reduce load on the backup storage.
0 -
Thanks - I see that in our system and I'll bring it up with the team this Friday!
0
Please sign in to leave a comment.
Comments
3 comments