Backup Exclusions

snap2 has a built-in default list of wildcard patterns.  It is:

- *~
- *.log
- temp/
- tmp

This means the program does not backup files or directories ending '~' and '.log', and ignores all files in directories named temp, and all directories or files named 'tmp'.  This list is stored in the file ~/.snap2/default/exclude/default.  If you ever want to change or add to these default exclusions, click the 'Default Exclusions' button on the 'ADVANCED SETTINGS' tab. (Or of course, you could edit the file directly.)

 

The '-' starting the lines means 'exclude'.   The '**' matches any part of filenames, crossing directory boundaries (that is, including '/').  A single '*' matches any part of a filename, but stops at any '/'.  Any filename that does match any of the exclude patterns is included in the backup.  For more information on exclude patterns, see the rsync manual (http://www.samba.org/ftp/rsync/rsync.html).  For your convenience, below I have reprinted an excerpt from the man page.

INCLUDE/EXCLUDE PATTERN RULES

(from http://www.samba.org/ftp/rsync/rsync.html)

if the pattern starts with a / then it is anchored to a particular spot in the hierarchy of files, otherwise it is matched against the end of the pathname. This is similar to a leading ^ in regular expressions. Thus "/foo" would match a name of "foo" at either the "root of the transfer" (for a global rule) or in the merge-file's directory (for a per-directory rule). An unqualified "foo" would match a name of "foo" anywhere in the tree because the algorithm is applied recursively from the top down; it behaves as if each path component gets a turn at being the end of the filename. Even the unanchored "sub/foo" would match at any point in the hierarchy where a "foo" was found within a directory named "sub". See the section on ANCHORING INCLUDE/EXCLUDE PATTERNS for a full discussion of how to specify a pattern that matches at the root of the transfer.
if the pattern ends with a / then it will only match a directory, not a regular file, symlink, or device.
rsync chooses between doing a simple string match and wildcard matching by checking if the pattern contains one of these three wildcard characters: '*', '?', and '[' .
a '*' matches any path component, but it stops at slashes.
use '**' to match anything, including slashes.
a '?' matches any character except a slash (/).
a '[' introduces a character class, such as [a-z] or [[:alpha:]].
in a wildcard pattern, a backslash can be used to escape a wildcard character, but it is matched literally when no wildcards are present.
if the pattern contains a / (not counting a trailing /) or a "**", then it is matched against the full pathname, including any leading directories. If the pattern doesn't contain a / or a "**", then it is matched only against the final component of the filename. (Remember that the algorithm is applied recursively so "full filename" can actually be any portion of a path from the starting directory on down.)
a trailing "dir_name/***" will match both the directory (as if "dir_name/" had been specified) and everything in the directory (as if "dir_name/**" had been specified). This behavior was added in version 2.6.7.

Note that, when using the --recursive (-r) option (which is implied by -a), every subcomponent of every path is visited from the top down, so include/exclude patterns get applied recursively to each subcomponent's full name (e.g. to include "/foo/bar/baz" the subcomponents "/foo" and "/foo/bar" must not be excluded). The exclude patterns actually short-circuit the directory traversal stage when rsync finds the files to send. If a pattern excludes a particular parent directory, it can render a deeper include pattern ineffectual because rsync did not descend through that excluded section of the hierarchy. This is particularly important when using a trailing '*' rule. For instance, this won't work:

+ /some/path/this-file-will-not-be-found
+ /file-is-included
- *

This fails because the parent directory "some" is excluded by the '*' rule, so rsync never visits any of the files in the "some" or "some/path" directories. One solution is to ask for all directories in the hierarchy to be included by using a single rule: "+ */" (put it somewhere before the "- *" rule), and perhaps use the --prune-empty-dirs option. Another solution is to add specific include rules for all the parent dirs that need to be visited. For instance, this set of rules works fine:

+ /some/
+ /some/path/
+ /some/path/this-file-is-found
+ /file-also-included
- *

Here are some examples of exclude/include matching:

  • "- *.o" would exclude all names matching *.o
  • "- /foo" would exclude a file (or directory) named foo in the transfer-root directory
  • "- foo/" would exclude any directory named foo
  • "- /foo/*/bar" would exclude any file named bar which is at two levels below a directory named foo in the transfer-root directory
  • "- /foo/**/bar" would exclude any file named bar two or more levels below a directory named foo in the transfer-root directory
  • The combination of "+ */", "+ *.c", and "- *" would include all directories and C source files but nothing else (see also the --prune-empty-dirs option)
  • The combination of "+ foo/", "+ foo/bar.c", and "- *" would include only the foo directory and foo/bar.c (the foo directory must be explicitly included or it would be excluded by the "*")

 

Comments

Hi Steve, I'm very sorry, for

Hi Steve,

I'm very sorry, for some reason I didn't receive notice of your comment until today!

I realize you probably won't see this reply, but for the record:

The pupsave file contains everything you have customized or added to puppy, so it is the perfect candidate to back up.  If you could run a snap2 mirror-type backup from "outside" Puppy, I think that would be ideal.  By "outside," I mean from a Linux OS that accesses the same hard drive where the pupsave file is stored.

If you can't do that, then I would suggest you back up all the files in your system that would be considered data files.  Rather than specifyong the root ('/') and listing exclusions, I think you could simply back up all of /root and all of /etc.  Here are other directories that you may have to back up too:

  • /usr/lib/mysql (if you have mysql databases)
  • /var/www (if you run a webserver - not likely on puppy, I think)

The idea is to back up whatever is not part of the Puppy OS that you cannot easily replace.

Since I am so late in replying to your post, I will not go into anymore detail unless you comment again.

Can snap2 be used to backup/restore the contents of a pupsave?

First, thank you for snap2. It works very well for me in Lucid Puppy 5.20. My question is about backing up the pupsave file **contents**. It seems to me that having multiple 500 MB pupsave file backups just to capture the minor changes I've made in my system is not very efficient. Plus it is mildly inconvenient to have to boot into ram to back up the pupsave file. I'd rather have the "no worries" approach that snap2 gives me. Would it be possible through the use of exclusions (or some other technique) to back up the / file structure in such a way that if your pupsave file was corrupted, you could boot into ram, mount the backup partition, copy back the contents onto the /, and then shutdown - saving a new pupsave file? It seems to me that it could work, but my understanding of linux filesystems is pretty weak. I imagine that you would have to stay away from some of the /mnt and /dev paths to avoid death by infinite loop. Thanks in advance, SteveR

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br> <img> <alt> <h1> <h2> <h3>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is to prevent automated spam submissions.
  ___          _____     _              ____  
|_ _| _ __ |__ / / \ __ _ | _ \
| | | '__| / / / _ \ / _` | | |_) |
| | | | / /_ / ___ \ | (_| | | _ <
|___| |_| /____| /_/ \_\ \__,_| |_| \_\
Enter the code depicted in ASCII art style.