this post was submitted on 13 Jan 2024
32 points (97.1% liked)

Selfhosted

39203 readers
254 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
32
submitted 8 months ago* (last edited 8 months ago) by Krafting to c/selfhosted
 

Hello everyone!

I have a small OrangePi running some small services on it (some with Docker and some without Docker).

And I'd love to know how do you backup your single-board computers.

Do you just rsync the system to a storage server ? Do you plug in a USB drive and rsync on it ? Do you save only the important data or the whole system ?

For now my SBC is not backed-up and I'd like to get a good backup solution up and running quickly! (I don't trust SD cards to last long...)

I have access to USB drives and disks and also another big server with 20TB of storage which I can make the backup to if needed!

Thanks for your help !

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 8 months ago* (last edited 8 months ago) (1 children)

I wrote a bash script a while back that uses sshfs to mount an ssh server to the filesystem, then uses dd to write /dev/mmcblk0 to it as hostname-date.img and finally unmount the ssh server. Cron job runs that daily.

I run that on each of my rpis. (just one rn, but theres been as many as 4 going).

Any time I have an issue, be that my fault or not, I can just pull the sd card and write the last .img to it directly.

There's some extra stuff in there too: it checks for the dependancy sshfs and installs it if missing (for deploying to a new system without reconfiguring), cleans up backups older than x days, logging, and the ability to write the log file as a test instead of the whole filesystem.

[–] [email protected] 1 points 8 months ago (1 children)

Sorry, but do you have a setup where you don't need to worry about the atomicity of that operation? It sounds simple and effective, so I'd like to do it, but I'm concerned I may get something halfway through a write.

I suppose the odds are you'd have at worst a bad log file whereas config files and binaries are used read-only the majority of the time.

[–] [email protected] 2 points 8 months ago

I've run it on every pi I've used for several years now, though they are typically pretty quiet systems. Usually something like pihole or a reverse proxy. Not much writing going on. I've restored about a dozen of those images and never had an issue.

I also tend to keep 3-6 backups at a time. If the most recent is messed up for some reason, there's others to try. (though I've never actually had to try more than one)