After installation and the service fuse-backup is started, now you can add a directory to backup:
Creating the directory in fuse-backup
(as normal user)
$> cd /srv/backupbtrfs/mount
You will see that your homedirectory is created. Access that:
(for me as user sbon that is:)
$> cd home/sbon
For you that is of course different.
Now you can create a directory here which is also in your homedirectory, as a mirror.
Suppose you have the directory Project/MyNewCProgram, which contains the sources of a C program you're working on.
Create this as follows:
$> mkdir Project
$> cd Project
$> mkdir MyNewCProgram
The fuse fs lets you create this directories here when you have read access to these directories, which is the case for directories in your home directory, which you own.
Get the unique id for the directory
Now get the unique identifier db_id for this directory:
$> getfattr --name='system.db_id' --encoding=text MyNewCProgram
file: MyNewCProgram
system.db_id="6"
Add this unique id in your system backups
This number is an example, in your case this is probably different.Change to the system directory where you can manage your backups:
$> cd /srv/backupbtrfs/mount/.system/backup
$> ls -al
gives the uidnr's of the users currently logged in, one of those is probably you. In my case that is 1000. For you this is probably a different value. cd into that:
$> cd 1000
$> ls -al
will give you probably nothing, since you've not created a backup yet. Every backup you've created a item should exist here. Create the db_id directory here with the value you got earlier via the getfattr call:
$> mkdir 6
will enable backups for the target directory Project/MyNewCProgram.
Testing a subvolume is created
A subvolume is created:
(as root, normal users do not have access:)
$> ls -al /srv/backupbtrfs/backup
You'll see a list of users currently having backups, using the uidnr again. One of those is yours. I take my uidnr (1000):
$> ls -al /srv/backupbtrfs/backup/1000
This will list all your backups, using an unique number. One of those has just been created. It's probably 1 or 0. Suppose it's 1:
$> ls -al /srv/backupbtrfs/backup/1000/1
will give you the backup directory, and a symbolic link to the target.
Adding mimetypes
Back to the directory 6 which you've just created. At this moment the backup is enabled for the target directory, but it will not do anything. First create the rules for this backup. When creating this directory, fuse-backup has scanned the target directory for mimetypes, and created those in the system mimetype directory. For every rule create a symlink like:
$> cd 6
$> ln -sf ../../../mimetype/text/x-chdr include.mimetype.chdr
$> ln -sf ../../../mimetype/text/x-readme include.mimetype.readme
$> ln -sf ../../../mimetype/text/x-c++src include.mimetype.c++src
$> ln -sf ../../../mimetype/text/x-csrc include.mimetype.csrc
cause we're dealing with a directory for C-development. You only want to backup headers, sources and probably the README.
The default behaviour of fuse-backup is to populate the backup and create the first snapshot after the first next login. You can force doing that now by creating an entry in the system queue directory:
Start the backup now
$> cd /srv/backupbtrfs/mount/.system/queue
$> mkdir 6
Now take a look at the target (in the FUSE fs):
$> cd /srv/backupbtrfs/mount/home/sbon/Project/MyNewCProgram
$> ls -al
will give you entries for everything being backupped and versioned at this moment. Every file which is selected for the backup in the target is presented as a directory here. This is because this way it's easy to browse every version: versions are entries "in" the file directory.
So for example the contents may look like:
total 2
drwxr-xr-x 2 sbon users 4096 Jul 27 01:08 .
drwxr-xr-x 2 sbon users 4096 Jun 26 10:36 ..
drwxr-xr-x 2 sbon users 1 Aug 6 11:35 main.c
drwxr-xr-x 2 sbon users 1 Aug 6 11:36 main.h
Now the directory main.c has size 1, which means there is one version, which is of course the first snapshot, we've just created. Change into this directory:
$> ls -al
total 1
drwxr-xr-x 2 sbon users 1 Aug 6 11:35 .
drwxr-xr-x 2 sbon users 4096 Jul 27 01:08 ..
-rw-r--r--1 sbon users 3516 Jul 17 08:53 201507271136
The file 201507271136 is a copy of the file main.c in /home/sbon/Project/MyNewCProgram, and you can access that. The permissions and owenrship are of those at the moment the snapshot is created.