maxnet / berryboot

Berryboot -- Boot menu / OS installer
http://www.berryboot.com/
Other
808 stars 133 forks source link

Is there a way to script a backup of an image? #215

Open greavette opened 9 years ago

greavette commented 9 years ago

Hi Max,

Great job on Berryboot!

Is there a way to script up the backup of an image on a schedule? I'm considering using OMD monitoring on my Pi through BerryBoot and want to create a way to do a hot backup to a network share of the Raspbian image I'm running through BerryBoot.

Is this something you would consider adding to BerryBoot perhaps. Or would you have suggestions on how this could be done through scripting.

Thank you.

maxnet commented 9 years ago

Berryboot only does cold backups, when the distribution is not running. For hot backups you may be better off by using rsync, along the lines of:

rsync -av --delete --numeric-ids --exclude={"/dev","/proc","/sys","/tmp","/run","/mnt","/media"} / /mnt/some-nfs-share/backup-folder
greavette commented 9 years ago

Thanks very much Max!

Along this same thought process...have you ever seen (or perhaps done yourself) a script that will change the default O/S on Berryboot on reboot? Similar to these steps - http://rvalbuena.blogspot.jp/2013/02/changing-berryboot-selected-os-on.html.

My thought is an even more perfect copy of a berryboot image would be to have two images on BerryBoot. When you want to backup a berryboot image we could simply change the default to the second image. Then from within the second image again mount the raw storage and then copy the first image to a network share. In this way we have a perfect (backed up) copy of the image.

alec801 commented 8 years ago

I am running something similar to what you have described. I have 2 copies of Raspbian installed on my berryboot SD card

The main image is the image that I run all of the time. Any code I have on the image is updated via git repos. If I need to update the image..

i have a script that boots into the recovery.img

mount /dev/mmcblk0p2 /mnt;
echo -n "recovery.img192" > /mnt/data/runonce;

from the recovery.img, mount the raw storage mount /dev/mmcblk0p2 /mnt

backup/write over the main.img user data

/mnt/data/main.img

backup/write over the main.img

/mnt/images/main.img

My main reason for doing this is that I will be deploying pi's in remote locations, so I would like to be able to update the image without having to physically be there.