Scheduled backups don't exclude the required directories


I noticed that virtualmin seems to ignore my request to exclude directories and their contents from its scheduled backups.

Please, could I humbly ask you if you see where I may have gone wrong ?

In the scheduled backups section ( /virtual-server/list_sched.cgi ) I define a backup to cover an entire domain.

I ask that some directories are excluded in that part : Features and settings > Files to exclude from each domain.

Those paths to exclude, for instance, are :

  • public_html/gal/
  • /tmp/
  • /blog/
  • /misc/
  • /_data/

I did check the information shown when we click to see the popup text :
This field allows you to enter the relative paths to files under each virtual server’s home directory to exclude from this backup. For example, to skip Webalizer statistics, you could enter public_html/stats.
According to this, I am providing relative paths, so it should be OK.

And yet…
tar -ztvf essayonsvoir.tar.gz > contenubackup.txt

It showed me that EVERY file I wished to see excluded was, still, present in the backup archive :frowning:

For instance, there was the public_html/gal/ directory, its subdirectories, and the images I was storing inside the various subdirectories.

Frankly, I’m at a loss as to understand what is wrong. I searched the forum for past similar enquiries, and it seems wildcards will not work either.

Please, would someone know how to fix this issue ? Thank you VERY MUCH if you can help !

Of course, should you need more information or testing, I’d be glad to provide, hopefully it can help improve virtualmin with the fixing of a bug, so that’ll be a win-win situation :wink:


The exclude patterns are passed along to tar’s “–exclude” option. They should, in theory, accept anything that tar accepts.

Out of curiosity, if you just enter “gal”, rather than the full path to it, does that work properly?



Argh, so wildcards DID work !

Well, thank you for the answer, that ticked me in the proper direction :slight_smile:

From further testing (and this time not for a 40 GB large domain -_- ), I found that :

  • gal : isn't blocked
  • /gal/ : isn't blocked
  • *gal* : is blocked (but is dangerously generous and would almost certainly falsely exclude unwanted items)
  • */gal/* is blocked (and that one is perfectly satisfactory, VICTORY ! \o/ )

I would suggest the popupped help to be updated to mention wildcards, for, in its current version, it is falsely (at least with Debian Wheezy !) telling it works without wildcards.

There were false results in the beginning of my testing, something may be have gone wrong because of the choice of an incremental method, the following tests were made with the FULL backup option.

Against what does Virtualmin even compare the backups, for its incremental method ? Against a former tar.gz backup ? Or does it store somewhere the locations ?

This incremental question is the last thing I couldn’t test properly, sorry about that :slight_smile:

I tried different methods and this worked perfectly. Please hit “Like” if it works for you as well.

Here is a solution:

Case I: Single Directory
Exclude a directory from backups:


Then syntax in “Files to exclude from each domain” should be:


Case II: Multiple Directories
Exclude multiple directories from backups:


Then syntax in “Files to exclude from each domain” should be:


Case III: Exclude file extensions

Exclude .exe .tar .tar.gz :

Then syntax in “Files to exclude from each domain” should be:


Case IV: All above cases at once

public_html/docs public_html/var public_html/media/cache *.exe *.tar *.tar.gz

These exclude files/directories are applicable globally for all websites/subdomains included in the backups. If you want to exclude the files/directories for website specific then you need to create schedule different backups for each domain.