Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

S.B.G

Moderator
Original poster
Staff member
Sep 8, 2010
26,736
10,580
Detroit
Does anyone know of a simple way to automatically backup Raspbian OS which resides on an SD card in a Raspberry Pi?

I'm searching around the Internet this morning looking for a simple and easy solution, but so far I haven't found anything quite like I want. Most of the things I find are just making copies of the SD card which means shutting down the Pi and taking the card out.

What I want is something akin to Time Machine, VEEAM or Carbon Copy Cloner backup. Essentially, an automatic backup solution I can do over the network to say a shared folder on my Mac mini or a USB HDD if need be, while the Raspberry Pi is still running. I assume it may require some kind of cron job, but I'm not very skilled in that stuff without following step-by-step instructions.
 
https://pimylifeup.com/backup-raspberry-pi/

I have a Pi running Pi-Hole and Homebridge and been fussing around trying setup a good backup system without much luck. I must have spent two hours the other day trying to get the process at this link under "Backing up your Raspberry Pi to a USB Drive" to work... and kept getting error messages. I finally got annoyed and gave up, but plan to come back to this soon. :mad:

But the process described at this link is exactly what I want to achieve... auto backup to a USB key.
 
Well that stinks. Maybe tonight or this weekend I'll give it a try and see what happens. Perhaps we can compare notes on errors too.

Anyway, I have 3 Raspberry Pi's in all.
The one I want to backup the most is the MediaWiki. The other two I don't care as much about if they die as they're easy to rebuild and I have the pertinent information backed up elsewhere too.

But the MediaWiki is the newest, built yesterday and is replacing the MediaWiki I have in a VM. Leaving the VM run continuously on the 2014 Mac mini bogs it down after a while. So I always leave it off unless I really need it. But I also want instant access to my Wiki too, so I built it on a Raspberry Pi.
 
  • Like
Reactions: Weaselboy
I did a quick google of keywords rsync on pi, which showed a number of promising results.

One of the more interesting ones was about using a Pi as an rsync server:
https://opensource.com/life/16/3/turn-your-old-raspberry-pi-automatic-backup-server

So if you have a new Pi and an old Pi, you can use one to backup the other. The article shows how to use a Big Hard Disk, and setup an automated cron job on the originating Pi, and also the cmds needed to restore (an oft-forgotten piece).


Another thing: Macs have rsync builtin. So you can test things on a Mac, use a Mac as a destination server, ask questions about rsync on the Mac Programming forum here, and have the other benefits of portability.
 
  • Like
Reactions: S.B.G and Weaselboy
Nice. Thanks @chown33 I'll check that out later today.

I just got done troubleshooting an error on my wiki that drove me nuts since yesterday. It turns out there was a special character ( ∑ ) at the top of the LocalSettings.php before <?php. I have no idea how I did that, but must have fat-fingered in there when editing the file in nano.

Right now I'm trying to figure out why the maximum upload size still shows 8MB when I changed it to 32mb in the php.ini file ever after restarting the php service.

Edit: Figured it out. I just remembered there is another spot in the php.ini file called
Code:
php_value post_max_size
Edited that and now I'm good.
 
Last edited:
Progress has been made. I finally figured out how to manually back up my Mediawiki folder from the Raspberry Pi to my Mac over the network. I had to install the latest version of rsync on macOS to do it.
Code:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then check to see that /usr/local/bin is the first line in the path list.
Code:
sudo nano /private/etc/paths
Then install rsync.
Code:
brew install rsync

Then from Terminal I executed this code to sync the folder on the Raspberry Pi to the Mac.
Code:
rsync -avz -e ssh pi@10.0.1.84:/var/lib/mediawiki/ mediawiki/
It worked like a charm too.
So this simply backs up the Mediawiki folder which houses all the important stuff I run this Pi for in the first place. So now it gets backed up to the Mac mini which is backed up to the Time Capsule.

Now I just have to figure out how to setup a cron job on macOS to automate it.

Edit: New thread in Mac Programming to try and figure that out.
 
Last edited:
  • Like
Reactions: Weaselboy
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.