Generally, When backing up large accounts, it can be desirable to skip certain large directories or exclude files for security reasons.
Sometimes, we notice that large backups and often times, the reason is due to customers inadvertently taking backups of other backups that are stored within the user's home directory
For example, WordPress plugin backup solutions, Softaculous backups, etc.
It should be noted that It is only going to inflate the size of the backup by the size of the included backup, and thus, consume more disk space.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related DirectAdmin control panel queries.
In this context, we shall look into how to archive site files and to exclude backups files, error logs and other files not necessary for site restoration.
How to Exclude Files from Backups in DirectAdmin ?
DirectAdmin offers the feature to prevent backups from being unnecessarily large.
Usually, path for configuration file is:
The format of the file must be relative to /home/$USER and should not include a "/home/$USER" prefix.
[root@server]# /usr/local/directadmin/directadmin c | grep skip
The following setting to be set in the DirectAdmin configuration, which is indeed set by default for newer versions:
The following command to check and confirm that this is set:
# /usr/local/directadmin/directadmin c | grep allow_backup_exclude_path
In order to, exclude Awstats data from backups, which is located at /home/$USER/domains/domain.com/awstats.
We can do so with the following to exclude all domains Awstats data for the user:
# echo “domains/*/awstats” >> /home/$USER/.backup_exclude_paths
# chown $USER. /home/$USER/.backup_exclude_paths
A handy feature of the DirectAdmin backup system is that we can exclude all files of a particular type or extension.
For example, we can add the following to the .backup_exclude_paths file in order to exclude all .tar, .gz and .zip files from our backups:
The path to the files do not matter as the * encompasses as possibilities.
DirectAdmin also allows to skip certain content in backups on the global level, though it is not as customizable.
Here are the options:
[root@server]# /usr/local/directadmin/directadmin c | grep skip | grep -v fail
If we like to enable any of these, set them to 1 in /usr/local/directadmin/custombuild/options.conf and restart DirectAdmin using the following command:
# service directadmin restart
[Need support in fixing DirectAdmin errors? We can help you. ]