Common exclusions and inclusions from %APPDATA%

#1

Continuing the discussion from Staggered versioning / thinning out versions:

In order to make it easier to tackle the APPDATA problem, how about building a repository of common exclude and include filters that people can copy and paste into their backup jobs?

(Just to keep things simple, let’s limit this topic to Windows. Feel free to start a similar topic for another OS)

One starting point might be these posts from crashplan:

So, from those I gather the following AppData related exclusions:

.*/AppData/Local/Temp.*
.*/AppData/Temp.*

.*/AppData\Local\Microsoft\Windows\Notifications\WPNPRMRY.tmp
.*/AppData\Local\Microsoft\Windows\UsrClass.dat.LOG1
.*/AppData\Local\Microsoft\Windows\UsrClass.dat.LOG2
.*/AppData\Local\Microsoft\Windows\WebCache\WebCacheV01.dat
.*/AppData\Roaming\Skype\your.skypename\main.lock
.*/AppData\Local\Google\Drive\lockfile
.*/AppData\Local\Microsoft\Internet Explorer\Recovery\High\Active*.dat
.*/AppData\Roaming\Mozilla\Firefox\Profiles\<profile>.default\parent.lock
.*/AppData\Local\Google\Chrome\User Data\Default\Current Session
.*/AppData\Local\Google\Chrome\User Data\Default\Current Tabs
.*/AppData\Local\Google\Chrome\User Data\lockfile

(Not sure whether forward-slash or backslash are correct here. Neither have I tried whether the RegEx syntax above actually works with duplicati.)

Please share your exclusion/ inclusion settings for the AppData folder. :slight_smile:

1 Like

Exclude list for windows
#2

Thank you! I’ve been planning to start this very topic for a while but am still reviewing my own backup contents to see what else can be filtered out.

0 Likes

#3

For what it’s worth, here is the short list I came up with to get started (includes more than just AppData).

-*.part
-*.tmp
-*.ost
-hiberfil.sys
-pagefile.sys
-swapfile.sys
-*\UsrClass.dat*
-*\ntuser.dat*
-$Recycle.Bin\
-Windows\
-MSOCache\
-*System Volume Information*\
-*\AppData\*\Temp\
-*\AppData\*\Internet Explorer\
-*\AppData\*\Microsoft\*\WebCache\
-*\AppData\*\Microsoft\*\INetCache*\
-*\AppData\*\Microsoft\Office\*\OfficeFileCache\
-*\Temporary Internet Files\
-*\Firefox\Profiles\*\*cache*\
-*\Microsoft\Windows Defender*\
-[.*\x7E\$[^\\]*]

Looks like you can’t override an exclude filter with an explicit “+” include entry, so I’m probably going to end up dropping the exclusion for the Windows directory so I can backup the Duplicati-server.sqlite database in C:\Windows\System32\config\systemprofile\AppData\Local\Duplicati.

1 Like

#4

Really? I was assuming that adding an include filter will overwrite any exclude filter there may be, but I haven’t tried it yet. Have you?

0 Likes

#5

Yes tried a bit earlier without any success. Tried it at the start of the list as well as the end on the off chance it mattered if the include was read in first or last.

It’s possible I messed up the syntax so curious to hear if anyone else gets it working. I had assumed that an explicit include would trump an exclude as well.

0 Likes

#6

I haven’t tried it myself but I think it is doable with something like this as mentioned on Github:

Include some files, exclude others. Now let’s define a filter that does both of the above. First it excludes @eaDir specifying -/@eaDir/. Then it includes only JPG files specifying +.jpg. The problem here is, that Duplicati includes all files and folders per default. This means that e.g. /photos/movie.avi will also be part of the backup. To make the including rule effective an additional rule is required that excludes all files that do not match any of the current rules. The filter must say “exclude this, exclude that, include this but nothing else”. The best rule for “but nothing else” is a regular expression that excludes all files. It is -.[^/] on Linux or Mac, and on Windows the rule is -.[^\]. The rule says “exclude everything that is not a folder”. The final filter then is -/@eaDir/ +.jpg +.jpeg -.[^/]. Duplicati will process all folders but @eaDir/ and it will include JPG and JPEG files but exclude all other files.

0 Likes

#7

A user called @tygill already made this, and it is part of the latest canary:

2 Likes

Common source selection for windows PC?
#8

Will enabling this (or more generally, adding any new exclusions) result in these files eventually getting purged from the remote dblocks or will the versions prior to the change in filters/exclusions stay there until they would get removed from being too old?

Also my reading is this should be available in the latest canary but I cannot find it anywhere in the GUI?

0 Likes

#9

Duplicati should treat previously included files that are now excluded due to filter (or folder) changes the same way as if they had been deleted, so versions (and eventually the backed up files themselves) will be removed from the dblocks based on whatever “keep” rules are set in the backup.

In other words, filter and source folder changes do NOT cause an immediate purge of dblock contents.

2 Likes

#10

Windows has a default exclusion list already, it is in the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackup

I posted the question on the forums, but this might be a good way to generate the list instead of having a manually generated one. Or in addition…

3 Likes

#11

Awesome, I did not know that one. I guess this should be part of the default filters.

2 Likes

#12

I could see maybe offering to import it on first install into the Duplicati config (or one time importing it silently). After that though, it seems like it would be somewhat confusing if the registry settings were used and files were being excluded from Duplicati backups that you have to go manage completely outside of Duplicati?

0 Likes

#13

I sounds like the GUI might need the “Source data” Exclude section to be updated to include more detail on exclusions from less obvious sources (such as external or hard coded internal lists).

0 Likes

#14

I made an addition for it here:

2 Likes

Sucessful backup, but always 3 warnings
#15

Are you thinking that some users (or applications) will edit the list in the registry?

That would be strange, but I guess anything added to this key is really not meant to be backed up.

Not sure how to handle that, because the change would happen via another program that is not related to backup, and the user would not want the change the other program makes.

0 Likes

#16

Yes, I think the UI needs to correctly reflect the default excludes.

3 Likes

#17

I don’t think we should do anything to note changes that something outside of Duplicati makes to those registry keys.
I’d suggest that these default exclusions using this registry key can be implemented in one of two ways:

  1. Those keys are read during each backup run and added as a dynamic exclusion. Similar idea to the “temporary files” exclusion that excludes files with the “temporary attribute set”, in that it is a dynamic operation.
    If someone really wanted, add an option to not use the windows keys.
  2. Make it an option “–use-windows-default-exclusions” that has to be activated.

I vote for option 1, and here is why: that is the way that Microsoft says to do so. See Registry Keys and Values for Backup and Restore (Windows) for details.

In terms of having an option to not follow Microsoft’s specification, my gut says that is a mistake. I’ve installed enterprise backup software for about 20 years, and have never seen documentation that notes that these registry keys are used to exclude data. At best, I’ve run across it in a knowledgebase, and more often its been an engineering guide. It may be part of being qualified by Microsoft, I don’t know–but nowhere can I remember there being a “ignore windows files/dirs to skip”.

And if someone is advanced enough to modify those registry keys, all the more power to them.

3 Likes

#18

#1 makes the most sense to me, so long as it’s clearly stated somehow/somewhere to the end user that there are exclusions being enforced outside of Duplicati config. A way to bypass it when/if Microsoft does something dumb isn’t ever a bad idea :slight_smile: .

Another checkbox for “exclude OS defined files” or something would take care of both.

1 Like

#19

I added --default-filters=Windows to my existing backup definition.
Still the backup complains about NTUSER.DAT:

Warnings: [
Failed to process path: C:\Users\vegar\NTUSER.DAT => The process cannot access the file ‘C:\Users\vegar\NTUSER.DAT’ because it is being used by another process.,
Failed to process path: C:\Users\vegar\ntuser.dat.LOG1 => The process cannot access the file ‘C:\Users\vegar\ntuser.dat.LOG1’ because it is being used by another process.,
Failed to process path: C:\Users\vegar\ntuser.dat.LOG2 => The process cannot access the file ‘C:\Users\vegar\ntuser.dat.LOG2’ because it is being used by another process.,

]

Shouldn’t this warning go away if the default filter was in use?

1 Like

#20

Yes, I would think so…I’m not sure why it’s not working for you.

If you manually add those filters (with back slashes instead of forward) does it work for you? I’m curious if the issue lies somehow in the wildcard vs. the application of the Windows filter set.

0 Likes