Exclude folder when creating user backup

barut

Verified User
Joined
Sep 29, 2008
Messages
18
Hello!

We need exclude some folder in user home directory when creating user backup, like jailed folders.

Possible it will be property in directadmin.conf file, like

backup_exclude_home_dirs=somedir1;somedir2
 
So you might want to delete all necessary directories from temporary location just before tar runs:

http://directadmin.com/features.php?id=1183

This custom script don't work fine!!! DA don't wait after all commands in this script is over.
In this script i try remove home.tar.gz and use tar to create my own home.tar.gz without some dirs.
My result is:

tar -tvf home.tar.gz
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

home.tar.gz broken, because DA add this file to archive before my tar complete
 
Last edited:
Run /usr/local/directadmin/dataskq in debug mode to see details.

Set backup task in directadmin to run "now":

Code:
# /usr/local/directadmin/dataskq d2000
 
Run /usr/local/directadmin/dataskq in debug mode to see details.

Set backup task in directadmin to run "now":

Code:
# /usr/local/directadmin/dataskq d2000

It's realy help to me.

My mistake in script. STDOUT write to file with archive, and this damage it.

Thank you, ili prosto Spasibo :)
 
Last edited:
Does this:
directadmin.conf option to exclude home.tar.gz from User backups in DA.

skip_hometargz_in_backups=0

is the default internal value.
If you wish to skip the home.tar.gz files from User backups, set this value to 1.
mean that the "backups" and "user_backups" directories are excluded when the admin backup is running?
Are all reseller backups skipped also?

If not, how can I exclude the above directories?
 
Those dirs are already skipped by default.
It seems to me that my English is too bad to understand this...
According to this (http://www.directadmin.com/features.php?id=934):
directadmin.conf option to exclude home.tar.gz from User backups in DA.
skip_hometargz_in_backups=0
is the default internal value.
If you wish to skip the home.tar.gz files from User backups, set this value to 1.
I don't have this option in my configuration file, so I presume that these directories are NOT skipped by default and I MUST use skip_hometargz_in_backups=1, in order not to backup user's backups.
Am I right?

Or this is an option just for users, to backup their site without backing up their backups?

PS: Last question on this... promise...
 
skip_hometargz_in_backups is for skipping the home.tar.gz. If you look in a admin.user.username.tar.gz backup file, you will see in the directory 'backup', another .tar.gz; the home.tar.gz

This archive backups /home/user/* .. minus domains, and backups, imap, chroot jail folders ( source: http://help.directadmin.com/item.php?id=298 )

So mainly the files and dirs a user puts there himself trough ftp or something, but also the Maildir directory are put in home.tar.gz, and skip_hometargz_in_backups is to skip this backup.

backups, admin_backups etc. are always skipped.
 
I just read over this a few times to make sure I understand it properly.

As I read it, it means that if set to 1 instead of 0, then the backup won't backup your old backup tarballs. The presumption, I'm thinking, is that you won't want to keep getting larger and larger tarballs, backing up old backups again.

Hopefully John will post and clarify this for us.

Jeff
 
Hello,

Arieh is correct in that the home.tar.gz is not included in the backup file if this is set:
skip_hometargz_in_backups=1

The home.tar.gz is a file to include files directly from the /home/user/* path, which are not part of the DA structure (basically, anything you've added, plus a few other files)
If you extract the user.admin.username.tar.gz file, look in the backup path:
backup/home.tar.gz

and extract that file to see exactly what's in it.

This does not include user_backups, admin_backups, backups, domains (And a few less important files).
The mentioned backups directories are always skipped.
The domains directory won't be in the home.tar.gz, but will be in the top of level of the user.admin.username.tar.gz (domains directory).

As it happens, I actually wrote a guide 2 days ago on how to put your data into a special folder so it's not included in the backup:
http://help.directadmin.com/item.php?id=335

see tip 5), as it's what I'm referring to.
It uses the fact that DA already skips folders so can just use links to instance the data elsewhere in the path so it's still usable, but isn't included in the backups.

John
 
Finally option for excluding folders from backup is added https://www.directadmin.com/features.php?id=1737
But it doesn't work under FreeBSD - both bsdtar and gtar uses "--exclude-from" option, not "--exclude-file"

UPD: Oh, actually option name is not the case. Switching from bsdtar to gtar works fine but in .backup_exclude_paths file-pattern must be specified (eg. domains/domain.com/logs/*.gz) specifying just directory name isn't working for me.
 
Last edited:
Thanks for the report.
Going over the code, it already uses --exclude-from, so was a documentation error.
I've added a note about the *.gz requirement to the bottom of the id=1737 entry.

John
 
Please change order of arguments in FreeBSD version for compatibility with bsdtar.

Directadmin executes following command:
tar czfp /home/stats/backups/backup-Dec-18-2015-3.tar.gz -C /home/stats/backups backup -C /home/stats/ --exclude-from=/home/stats//.backup_exclude_paths domains
which produces an error:
bsdtar: --exclude-from=/home/stats/.backup_exclude_paths: Cannot stat: No such file or directory
bsdtar: Error exit delayed from previous errors.

If we move --exclude-from option to 3rd argument bsdtar works fine:
tar czfp /home/stats/backups/backup-Dec-18-2015-3.tar.gz --exclude-from=/home/stats//.backup_exclude_paths -C /home/stats/backups backup -C /home/stats/ domains
 
Last edited:
(Workaround for this bug: add "extra_backup_option=--exclude-from=/home/$username/.backup_exclude_paths" to directadmin.conf)

I am also on FreeBSD and can confirm that .backup_exclude_paths is not working even with explicitly defining the path to the files. I havent tried the above workaround yet...

Is this going to be fixed in the next version or should I go ahead and add the line to config file? Any ETA for the next Directadmin version?
 
(Sorry, I have just found "workaround" suggesteed by me is bad, don't use it - it will break backups for those users who don't have .backup_exclude_paths file.)
 
I'd like to exclude the installtron backups which are being included in the tarballs.
 
Can anyone tell me if the user excluded backups with .backup_exclude_path are also honored by the admin backups scheduled with cron jobs?
 
Back
Top