Turbocharge your ebook reader with KOReader

Backing Up KOReader's Data

For each book, KOReader creates a metadata file that contains book settings, notes, current position, etc. While you can sync the current position and export notes, it also makes sense to keep a backup of all the important data. To make it easier to manage both the content and metadata, use a dedicated directory on your e-reader for storing all ebooks (for example, Library). This way, you can back up everything by syncing the directory and its entire contents using rsync. There are two ways to do that.

The simplest approach is to connect the e-reader on a machine that has rsync. Most Linux distributions automatically detect and mount a connected e-reader. Then it's a matter of running the appropriate rsync command. For example:

rsync -avh --delete /path/to/ereader/Library/ /path/to/backup/dir

Replace /path/to/ereader/Library/ with the actual path to the Library directory on the mounted e-reader and /path/to/backup/dir with the path to the directory for storing backup data.

A slightly more technical but versatile approach is to install rsync on the e-reader so you can run backup operations directly on the device itself. To install rsync on a Kobo device, download and install the KoboStuff package [4]. Launch KOReader, open the top bar, switch to Tools | More tools | Terminal emulator, and tap Open terminal session. Run the rsync command that syncs the content of the Library directory to a Linux machine. Here's an example command you can use to back up the data to a Linux server running on a local network:

rsync -avhz --delete -P -e "ssh -p 22" /mnt/onboard/Library/ user@127.0.0.1:/path/to/library

Instead of typing long rsync commands using the built-in keyboard, you can speed up the process by adding the desired commands to the koreader/.ash_history file. Alternatively, you can write a shell script to automate the task. Create a text file named backup.sh in the koreader/scripts/ directory and add the following code (adjust the examples as needed):

#!/bin/sh
rsync -avhz --delete -P -e "ssh -p 22" /mnt/onboard/Library/USER@127.0.0.1:/path/to/library
rsync -avhz --delete -P -e "ssh -p 22" /mnt/onboard/.adds/koreader/clipboard/USER@127.0.0.1:/path/to/export

Save the file and make it executable using:

chmod +x /koreader/scripts/up.sh

To launch the script in the e-reader, open the terminal emulator and run the koreader/scripts/backup.sh command.

If you happen to use a second e-reader, and you want to download the saved settings and data, all you have to do is to create a shell script that runs the following commands:

rsync -avhz --delete --no-g --no-o -P -e "ssh -p 22" USER@127.0.0.1:/path/to/library//mnt/onboard/Library
rsync -avhz --delete --no-g --no-o -P -e "ssh -p 22" USER@127.0.0.1:/path/to/clipboard//mnt/onboard/.adds/koreader/clipboard

Every time you run the scripts described above, you'll be prompted to enter the password twice, which can quickly become a nuisance. To fix this, generate an SSH key pair in KOReader, and add the public key to the list of authorized keys on the remote machine.

To generate an SSH key pair, launch the terminal emulator in KOReader and run the ssh-keygen command. Follow the prompts, but skip specifying a passphrase. This generates a key pair in the /usr/local/niluje/usbnet/etc/dot.ssh/ directory. To make sure that the keys are there, run:

ssh-agent sh -c 'ssh-add; ssh-add -L'

Copy the /usr/local/niluje/usbnet/etc/dot.ssh/id_rsa.pub file to a Linux machine, and use the command below to add it to the authorized_keys file on the remote server:

cat id_rsa.pub | ssh USER@127.0.0.1 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

From now on you can run the shell scripts (or any commands and actions that require an SSH connection to the remote machine) without a password.

Wrap Up

You don't have to stop here, because KOReader has so much more to offer. Dive into its gesture controls, and you'll discover that you can control practically every aspect of the application via gestures. Once you've configured gestures to your liking, explore KOReader's reading statistics. In short, you'd be hard pressed to find a better and more powerful reading application. And if you are willing to put some effort and time into learning its functionality, you'll be rewarded with a reading experience you never thought was possible.

The Author

Dmitri Popov has been writing exclusively about Linux and open source software for many years. His articles have appeared in Danish, British, US, German, Spanish, and Russian magazines and websites. You can find more on his website at http://tokyoma.de.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Introduction

    This month in Linux Voice.

  • DIY Read-It-Later Tool

    Instead of relying on a third-party read-it-later service, you can use this DIY tool to save articles from the Internet in a format that meets your specific needs.

  • FOSSPicks

    In what might be either the onset of tin foil hat disease, or a nagging conscience, Graham has recently started to move as many of his SaaS accounts to servers under his control, as you'll no doubt read in these pages.

  • MkDocs

    MkDocs, a static site generator, lets you easily transform Markdown files into ready-to-use, user-friendly project documentation.

  • Kitchen Kiosk

    Create a kiosk display from an old eReader to show data culled from Home Automation, Raspberry Pis, and Arduinos.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News