r/Paperlessngx • • 23d ago

Avoiding clobbering in document_exporter

I just switched to using document_exporter for backups. I used to just back up the volumes with rsync, but once my hard drive actually died, I found that extremely difficult to restore. (It was only due to the advice from u/sogo00 -- thank you, by the way! -- that I had any idea what pitfalls there may be, and addressed some in advance; the restore took me multiple hours.)

I'm expecting this new method to be much, much better. But there's one thing that I'm not so sure is: I can't find information on whether exporting repeatedly to the same directory would rewrite everything each time, clobbering all the files and wearing the disk significantly more than rsync did with my previous backup setup. If that is indeed the default behavior, is there a simple way to get it not to clobber?

My only thought would be to make a tmpfs, export to there, and then use rsync, but I don't have enough RAM for that, and have not managed to figure out how to do that in chunks.

4 Upvotes

5 comments sorted by

3

u/konafets 23d ago

> The document exporter is also able to update an already existing export. Therefore, incremental backups with rsync are entirely possible.

https://docs.paperless-ngx.com/administration/#backup

1

u/BlackHatCowboy_ 23d ago

I don't know why I looked and looked and missed this before. Going through the documentation again after your comment, I can see that document_exporter behaves basically like rsync by default. So everything is perfect; thank you.

1

u/BlackHatCowboy_ 23d ago

For anybody trying to do what I'm doing, I want to note one pitfall I experienced. Because the docker container only sees the directories it has mounted, you by default have very few choices of where to export, with the export directory being one of those. So I just mounted my backup drive to the (empty) export directory -- but the container still didn't see it. After messing around, I found that the only way to get it to see it is:

  1. Bring down paperless (docker compose down)
  2. THEN mount the drive to the export directory
  3. NOW bring up paperless (docker compose up -d)
  4. At this point, and only if things are done in that order, the container will see the drive contents in the export directory and document_exporter can be run

It was very frustrating for a bit there, but now I've got it working.

1

u/Jaded-Asparagus-2260 22d ago

What does your compose.yaml look like? You should define your export volume bind there. Then it should work without issues.

1

u/BlackHatCowboy_ 22d ago

It is defined there; the issue is that my backup drive is usually not mounted (in fact, it is generally in a different location, not connected to anything). And if I mount it while the container is running, the container doesn't see it. The process described above makes it visible to the container.