Corvalan
Posts: 2
Joined: Wed May 22, 2013 6:37 am

Backing up the RPi

Wed May 22, 2013 6:43 am

Hi,

I'm quite new to the RPi, but due to the execellent community I manged to setup my RPi as an owncloud server. But since this is going to hold all my appointments and contacts I was pretty scared on having a corrupt SD card at one point. Therefore, I created a diskdump based backup solution. Twice a weak (using cron and a shell script), I run a diskdump to a USB stick and if this was succesfull I will delete the old image on the stick. Now here comes my question:
What if I have a corrupt SD card and the dd process starts? Will it run to the end and return no error? If so I'd risk to replace my old and healthy image with the image of a corrupt SD card.

Thanks for your support!

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5623
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Backing up the RPi

Wed May 22, 2013 7:48 am

Corvalan wrote: ...
What if I have a corrupt SD card and the dd process starts? Will it run to the end and return no error? If so I'd risk to replace my old and healthy image with the image of a corrupt SD card.
...
If you're writing the SD card image directly to the USB stick (ie. like the SD card creation process) there could be a problem. However if your USB stick is formatted and large enough to hold multiple copies of the SD card you could "dd" to an image file instead, after renaming ("mv" command) the previously written image file. That would give you an extra level of backup. A more efficient alternative is just to use (the traditional) "tar" (Tape ARchive) command to back up critical directories. There are other methods, IIRC, "rsync" and "unison" - they may require additional packages to be installed.
HTH, Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

Corvalan
Posts: 2
Joined: Wed May 22, 2013 6:37 am

Re: Backing up the RPi

Wed May 22, 2013 11:13 am

Hi Trevor,
Basically what you suggested is exactly what I'm already doing. I write a second dd image to the stick and if dd returns no error I delete the older image. I just need to be sure that running a dd of a corrupt sd card will raise an error.
Regards,
corvalan

Return to “Beginners”