Remarkable Backup Utility

Overview
 

A remarkable tablet is a digital paper replacement: an e-ink screen tablet with a stylus. To prevent dependency on the proprietary tools of Remarkable, I decided to develop a simple script to automatically recreate the directory structure of the tablet, including both the original .rm proprietary binary file format files, and rendered PDF files.
personal

The Remarkable

Recently I got very into using a remarkable tablet, which is an e-ink screen (no backlighting and monochromatic, like a kindle) tablet with a simple stylus. It's not the only tablet of its type, but it's unique in its simplicity: it runs Linux with a basic daemon that presents a QT program that is the entire user interface. Remarkables offer only the ability to take notes and annotate documents, and a basic folder organization feature. They have a cloud service that lets you sync your notes with your phone and computer, and back them up. I've been using it extensively over the course of my first semester at Case as an alternative for paper, and it's been great.

One problem I have with the tablet, however, is how proprietary their ecosystem is. On their website where they advertise their cloud service, they note that the cloud is a good way to back up the tablet. But, if you sign up, the terms and conditions state that

You are responsible for backing up the content in Cloud Services, and reMarkable encourages you to do so in order to avoid loss of data. reMarkable shall under no circumstance be liable to you for loss of data.

This seems a bit hypocritical, but for the convenience their cloud offers I still choose to use it. Usually their cloud costs $4/month or so (which is reasonable, since they use Google cloud as their backend and need to cover that cost), however, they offered free lifetime cloud subscriptions to all customers who bought the tablet up until 2021 or so. When I got my tablet, I made sure to find someone on eBay to buy an account from, so my account is a lifetime account and the subscription cost is not a factor.

So, since the cloud is not a good backup instrument, the issue is that they do not actually have any alternate good tool to back up the tablet. You can use the desktop app to download PDFs of your files, but this is a manual process. This project is making a tool to backup all files on the tablet, while preserving the original folder structure.

Notebooks

Notebook structure
Notebook structure

Before I begin to discuss my tool, it's important to understand how notebooks work on the Remarkable. On the tablet, the file structure is actually just a blob. All the files are loosely stored in one directory and indexed. "Folders" are really just UUIDs in metadata json files. So, each notebook is in reality just a collection of a few specific files that loosely exist within the tablet's storage. However, Remarkable has a cloud service, and if you inspect the API of their cloud service they do containerize each notebook: they place them into tar files with the suffix ".rmn" ("dot remarkable notebook"). You can extract the contents of a .rmn directly into the tablet, and it should register the notebook. These .rmn packages include a folder of files with .rm files, which are custom binary files containing actual page data, along with a bunch of metadata files like the last-page or notebook name and orientation.

Preserving the actual notebook files as .rmn files is important because if the tablet were to ever get damaged and need replacing, and if anything happened to their cloud service, restoring from any other format, like PDFs, would mean loss of many notebook-specific features. You can annotate on top of PDFs, but they don't provide the same level of interactivity as an actual Remarkable .rmn notebook (for example, you can't move around marker marks, erase regions, etc).

But of course, exporting PDFs is important to me too, since one of the goals of this project is to be vendor-lockin-proof. I don't want a file in a format that requires proprietary closed source tools to make actually viewable or to convert, so rendering the notebooks to PDFs for purely archival purposes is also important. It would be unideal to no longer be able to edit my notebooks, but I still want to be able to review my class notes in the worst case. I wanted to create a simple recovery backup, and then also a second backup with PDFs.

Exporting

Web UI
Web UI
Desktop App
Desktop App

Mobile App
Mobile App

So, let's talk about how exporting works with the tablet natively. Exporting files is one of the weaker areas of the tablet. Right now, you can export notebooks through the desktop or mobile app as PDFs, email notebooks as PDFs, SVGs, or PNGs directly from the tablet, or, most interestingly, use the Web UI (a webserver that the tablet hosts over USB) to download files as PDFs using an internal PDF rendering script tablet-side. There is significant quality loss during this conversion process; only the original rmn files contain all the data.

Though the desktop software provides a great user interface and the ability to convert to PDFs, it was a proprietary binary and I did not see a good way to automate it. So, instead, I'd take advantage of the tablet's internal renderer to process the rmns. The USB-Web interface is a basic webserver that you can access when the tablet is plugged in to your computer through a web browser. In addition, the tablet hosts a basic REST API that one can use to explore the contents and run rmn to PDF conversions.

It's unideal to have to render the notebooks on the tablet itself, since it (understandably) doesn't have a very powerful CPU, but since the tablet would be plugged in anyway to transfer the files, I was okay with the long processing time. My plan was to just run the backup overnight.

Access the Files

SSH Access
SSH Access

It's a bit strange, but Remarkable (the company) does not want you to know that .rmn notebook files even exist. They don't have any documentation on them, don't discuss them anywhere on their website or apps, and try to abstract them away from you by forcing you into their proprietary cloud where the notebooks just appears as icons. In the web UI, these notebooks have a download button, but the download button just exports the notebook as a PDF. The rmn files are invisible.

So, then, how do we even know that rmn files exist? Remarkable uses some open source tools that use a specific open source license that requires them to provide you with access to the internal software as-is, they provide direct SSH access, where all the files within the tablet can easily be retrieved. Part of this project involved figuring out how to automate SSH with Python, which turned out to be fairly straightforward. I was able to use basic FTP to grab the rmns directly off the tablet, with access to root ssh.

The final product

To make my backup utility, I wrote a basic script to recursively scour the tablet using the API endpoint for viewing contents of a folder. I rebuilt the file structure of the tablet in a tar archive, storing both the rmn files and rendered PDFs. The final version is available on my github, and is functional.

Future Plans

Now that I have a working backup script, my future plans for this project are to make it so that I run the backup continiously from a dockerized server, which pulls my data from their cloud service's API. Running conversions to PDF this way will likely not be possible, but at the very least I'll be able to have copies of the rmns in case anything happens to their cloud or the tablet.

E-Ink

How e-ink works
How e-ink works

Something that I decided to research as I was tackling this project was how the e-ink technology actually works. It's super interesting, and was definitely worth looking into. Basically, e-ink screens consist of many tiny bubbles in a grid layout, with individually controllable electrodes behind each one. Each bubble is filled with a liquid and some very small white charged particles and very small black oppositely charged particles. Since opposites attract, they are tendent to cluster together. However, since there's an electrode, when it provides a charge only half the particles (those with the opposite charge) stick to the bottom of the bubble, and the other particles float up, resulting in a crisp black or white spot.

What's unique about e-ink is that it doesn't require a backlight like RGB LCD or OLED screens. Instead, an external light source is needed so that light gets reflected off of the surface black or white particles. You can add a backlight behind the bubbles, but Remarkable chooses not to, since it reduces the thickness of the screen, which results in a more paper like feel. This makes e-ink much more paper like, much easier on the eyes, and have much better battery life. Plus, Remarkable further enhances this paper like experience, as does kindle and other brands of e-ink tablets, by using a matte treated glass screen and specially designed stylus with particular pen nibs.