4

I am using snapshots for backing up data of my @home subvolume. But I would like to backup the real important data (like all my files, which are in @home, but not hidden directories because I am not interested in backing up .cache and other stuff which changes often, because this would lead to much waste of space in my incremental backup solution.

Could I somehow achieve it, that my real data are a subvolume in home without creating a directory in home which contains all data and is a own subvolume, or is this impossible by design?

My backup method is similar to: https://btrfs.wiki.kernel.org/index.php/Incremental_Backup

2 Answers 2

5

Dot-files have no special meaning to the filesystem, and btrfs send cannot currently (Feb 2014) exclude files or directories from the target subvolume.

However, btrfs subvolume snapshot does exclude subvolumes which are contained in the target subvolume (it creates empty directories in the snapshot), so

  • You may replace the directories that you want to exclude with subvolumes.

rsync, or a graphical frontend such as grsync, can exclude files and directories and allows for incremental backups.

If you give the parameter --inplace to rsync, it only overwrites the different portions in the files that have changed, rather than rewriting the entire contents of the files. This is an incremental backup, by definition, and saves space on btrfs.

Instructions:

  • Backup @home the first time with btrfs send/receive.
    To do further backups: create a snapshot of the backup of @home, then run rsync to copy the current home over the newly-created snapshot, and remember to give rsync the parameter --inplace.

rsync allows for extensive customization of the backup process, you can read the list of parameters by running man rsync on the terminal.

For completeness, I'll add another approach, which is not useful once you know how to use rsync: deduplicate after a "normal" copy (rsync or cp or whatever else).

  • Copy the files normally, then deduplicate with bedup. (A new bedup branch was introduced that supports kernel 3.12, but it is not applicable on Ubuntu at the time of writing, because not even Ubuntu 13.10 has such a recent kernel). This is not necessary if you pass --inplace to rsync, as suggested above.

Speaking of back-ups: Remember that btrfs is experimental and so is bedup.

2

No, you can't do that. At least not directly.

Snapshots work like fancy directories, which implies that all files beneath it are included.

You can still do all kinds of fancy stuff with symlinks, or mount --binds.

Why are you so much concerned with the temporary files? For all practical purposes they are really small, and usually saved on /tmp anyway (save for few well known applications like Firefox or GoogleEarth). If I were you I'd reconfigure these few applications to keep the data on other places, or - if that fails - I'd symlink the cache directories to somewhere else, outside /home/user. There are tools, that can manage such elaborate network of symlinks on all your computers in consistent way (e.g. Puppet).


Keep in mind, that this kind of backup is only half of what you'd need to have for a real protection for your data. Normally people configure the backup program to cherry-pick files/folders they care about and store the backups on the external server. And it is a central server, where all the snapshot-related magic with data takes place, not client.

Personally I use unison to sync my data with a btrfs subvolume on the central server. After each synchronization round of all my computers, I use SnapBtr script to do the snapshot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .