Discussion

SD card Backup - rpi-clone

3 4526
Hello,

How can I regularly backup the SD card used by my Banana pi?
Have you tried to use rpi-clone?
https://github.com/billw2/rpi-clone
Thanks in advance,
Looks interesting, I don't see why it should'n work...
You should try it!

jkw  
Post Last Edited by jkw at 2014-10-2 11:24

That worked for me, actually I use bananian and its important to mount the boot partition before you start the backup.

I've created a fork and added some more functionality (I don't have enough SD cards to have a "running" and a "backup" card for each pi, but I do have a lot of usb flash drives. So my idea was to use a flash drive instead of a card. The problem is obviously that, once I've messed up my OS, I can't boot from the flash drive, so I needed a kind of "restore mode".
Thats why I've added that to the script. So calling it "rpi-clone sda" will copy everything to my USB-flash drive. After destroying my system I just remove my SD card go to another pi, insert USB-flash drive and SD-Card(in cardreader) and run "rpi-clone sda sdb" to restore everything.
Just ensure the the first will be source and the second destination for your files).

I'm working on the extension right now, but it seems to be quite stable. ... I'll ask billw2 if I'm allowed to publish it, but if you want a first look, go to https://github.com/KoljaWindeler/pi-clone

forceps  
or, you can backup the SD card via dd on your desktop computer, then, use a script to backup selected directories and files on a running banana pi
  1. #!/bin/sh
  2. ROOT=/home/user/backups/banana_pi
  3. echo "Backup Banana Pi"
  4. cd "$ROOT"
  5. ssh hostname_of_bananapi 'sudo tar cvfz /tmp/backup.tar.gz /etc /other_dirs_need_backup' && \
  6. scp hostname_of_bananapi:/tmp/backup.tar.gz . && \
  7. tar zxvf backup.tar.gz && \
  8. rm backup.tar.gz
  9. ssh hostname_of_bananapi 'sudo rm /tmp/backup.tar.gz'

  10. echo "done"
Copy the Code

You have to log in before you can reply Login | Sign Up

Points Rules