jotta-cli

Making sense of it all

I wanted to back up my workstation to Jottacloud, and they make a command-line tool called jotta-cli which supports a number of operating systems. The documentation, on the other hand, leaves a few things to be desired. I've read the docs so you don't have to!

Install

Download the appropriate package from their website or use your favorite package manager if a package is provided that way. If you're using FreeBSD, it's as simple as:
root@sleipner ~% pkg install jotta-cli

Enable and start the jottad service.

The next step is to log in:
vidar@sleipner ~% jotta-cli login

You will need to obtain a personal token from their website jottacloud.com/web/secure in order to proceed from here. Scroll down to "Personal login token" and generate a new token.

Config

An important thing to note is that jotta-cli communicates with jottad, the daemon that runs in the background, and the jottad user needs permission to read the files in order to back them up.

Restoring from a backup will also be done by the jottad user, so it needs write access to the target location when restoring.

jotta-cli does not use config files in the traditional sense, all configuration has to be set using jotta-cli itself.

We have to specify each directory we want it to back up, and each directory will be referred to as a "backup" or "backupname" by the client.

It does not support filesystem flags like nodump so we have to specify ignore patterns internal to the client. These can be global or local to the specified "backup". The globs used here are non-standard, more on that later.

I will go over the commands needed to:

  • add directories to be backed up
  • add and delete ignore patterns
  • restore/download
  • see status

Now onto the primer

Add directories to be backed up:

vidar@sleipner ~% jotta-cli add /home/vidar/Documents

The "backup" will be named after the basename(1) of the path and can be accessed as Backup/<devicename>/<backupname>, in this case "Documents" and "Backup/sleipner/Documents" respectively.

Ignore patterns:

# Add a global ignore pattern:
vidar@sleipner ~% jotta-cli ignores add --pattern **/notforbackup**
# Delete the pattern again:
vidar@sleipner ~% jotta-cli ignores rem --pattern **/notforbackup**
# Add a backup-specific ignore pattern:
vidar@sleipner ~% jotta-cli ignores add --pattern **/notforbackup**

The globs work like this:

* matches everything but /
** matches everything
**/ matches zero or more directories

This way, anything I put in a directory called "notforbackup" will not be backed up.

Restoring backups:

Let's restore the Documents directory. Remember that jottad needs write access to the target.

vidar@sleipner ~/resss% ls -ld .
drwxrwxr-x  3 vidar  jottad  3 Oct 16 21:23 ./
jotta-cli download Backup/sleipner/Documents .

# jottad will download in the background. To see the progress:

vidar@sleipner ~% jotta-cli list downloads
7bed2239c6 /backup/...ocuments => /home/vi...ocuments: 5530 (32.62GiB) remaining of 5546 (32.68GiB)

Status report:

To see the backup status:

vidar@sleipner ~% jotta-cli status
[...]
------------------------------------------------------------------------------
 Backups   :
------------------------------------------------------------------------------
   Path      : /home/vidar/Documents
   Files     : 29173 (200.16GiB)
   Status    : 2 file(s) (1.53MiB) have not been backed up

------------------------------------------------------------------------------

Here we have 2 files that have not been backed up, but it doesn't tell us why! To find that kind of information, we need to find the log file:

vidar@sleipner ~% jotta-cli logfile
/usr/local/etc/jottad/jottabackup.log
This is often a result of the jottad user lacking permission to a file. Be on the lookout for lines like this:
Error checksumming /home/vidar/Documents/private.doc : files.Open(/home/vidar/Documents/private.doc | /home/vidar/Documents/private.doc) : open /home/vidar/Documents/private.doc: permission denied

However, these logs are not that great. I find the following one-liner quite useful for finding files that are not readable by jottad:

find . -not -group jottad -and -not -perm -004 -ls

The dreaded observe command

There's a command that lets you see transfers in real-time:
vidar@sleipner ~% jotta-cli observe
jotta-cli observe - connected
Press Q or CTRL-C to quit
no uploads
no downloads
Uploads
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
Downloads
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

The problem I have with this, is that Q or CTRL-C does not do anything at all! Nothing! Zilch! Nada! I have to kill it some other way when I'm done looking at it. Other than that, it's a really nice TUI for watching the progress.