Split backup files into X GB per file + download backup instead of direct restore

myH2Oservers

Verified User
Joined
Mar 13, 2006
Messages
246
Location
Netherlands
As the ftp_upload.php file will be modified in the next DA update I would like to request another feature for this file. We use this feature in a custom file for 6 months and it is working perfectly.

1.
Object storage is becoming more popular, but one of the disadvantages is that it does not support files larger than 5 GB. Also I have seen more feature requests about the possibility to split backups into multiple smaller files. I have created the following solution:

Script: /usr/local/directadmin/scripts/ftp_upload.php

Search (in the current file, maybe this is different for the coming update):

$FTPPUT -f $CFG -V -t 120 -P $PORT -m "$ftp_path" "$ftp_local_file" 2>&1

Replace with:

FILESIZE=$(stat -c%s "$ftp_local_file")
if (( $FILESIZE > 5138022400 )); then
split -b 4G "$ftp_local_file" "$ftp_local_file.part-"
$FTPPUT -f $CFG -V -t 120 -P $PORT -m "$ftp_path" $ftp_local_file.part-* 2>&1
else
$FTPPUT -f $CFG -V -t 120 -P $PORT -m "$ftp_path" "$ftp_local_file" 2>&1
fi

This replacement code checks the size of the backup file and compares it with my own limit of 4.9 GB (513802240 bytes). This could be a configurable number through your directadmin.conf file.
If the backup is larger than 4.9 GB then the backup file is split into smaller files of 4 GB each and the splitted files are uploaded. If the backup is smaller then the backup is uploaded as we are used to.

This works good, however restoring a splitted backup is not possible since the backup file consist of multiple files that must be merged first (cat “backup filename”.part* > “backup filename.tar.gz”). This feature should also be added (DirectAdmin checks if the backup is a splitted file, of so then add them together).

Another feature request:

2. It would be a nice improvement to have an option in the Admin Backup/Transfer to download a backup from FTP to the local system. Like the restore from FTP function, but then only copy to server (to admin_backups folder for example). Like the Plesk function “copy to server repository”. When we need a backup without restoring the full account we have to manually download the file using SSH and FTP commandline, would be helpful if this can be done using DirectAdmin panel, this is the only step that must be executed through SSH at the moment.
 
A good addition I forgot is to (io)nice the split command. Currently not using it but I see performance impact if the backup still runs during the morning and a split backup file occurs.
 
Back
Top