iainmaoileoin
Posts: 16
Joined: Tue Jul 31, 2012 10:57 pm

Thouhgts on backing up your SD card

Sun Dec 02, 2012 10:32 am

Unix comes with a huge range of backup tools.

I am 100% unix user. As a pi programmer I use the tools "dump" and "restore". Why?
Well I can train the tool to do "incremental dumps". This means I can work on my pi for a while then automatically copy off everything that has changed to another system. I can do this easily with 1 command line.
The toolset is dump/restore. as root apt-get install dump will do the work.

"man dump" shows everything (perhaps too much)
overview.
I do a "phoney" dump of the entire SD to set the time stamp.
I then take incremental backups from this dump at regular intervals. So all the wee edits to
strange files (done by you or the system) get noted for safety. You can put these changes in a file on the "SD" so you can ftp/scp/rcp them off yourself, or you can tell dump to write them to another system (I use unix, your mileage on windows may vary).
You can restore any or all of the files from the backup using the restore command.

It is not a great tool set, but it gives a simple way not to ever lose a change to a file.
---
Detail/assumptions
All my data lives on the "/" partition.
At the start of a project/week I do (as root) dump -u0f /dev/null /
The system thinks it is dumping the entire filesystem (but it is sending it to /dev/null)
Everytime I want to capture a snapshot of changes that ave happened I do a
dump -1u -z2 -f user@192.168.0.254:/safe/dump1 /
This captures all files that have changed since the last time I ran the dump. (192.168.0.254 is my clone machine), compresses them and sends them to /safe/dump1 on my remote machine.
You need to create this file yourself on the target machine the way I have set it up.

To bring things back:
cd /
restore -if user@192.168.0.254:/safe/dump1
allows me to "climb into" the dump and to manually select 1 or more files to be extracted.
using ls/cd/add to put files on the list.
extract brings them off the backup.

If you want to bring files back somewhere else on your disk (to diff them?)
mkdir /copy; cd /copy
restore -if user@192.168.0.254:/safe/dump1
you will bring files back under the "/copy" directory rather than overwriting the files on your current
SD.


enuf for starters?
1 dump -0u is not really needed, but telling people to play with dumpdates is not simple.
2 rsh or rmt needs to be set up on your target machine
3 window users (or people without rmt/rsh) can backup to the cd


iain

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: Thouhgts on backing up your SD card

Sun Dec 02, 2012 3:56 pm

Thanks, that is interesting. But does anyone know if these commands are in Arch as well? I do not see them in the repository. Not sure if they are in Arch itself, my Pi has not arrived, but they do not seem to be in the copy I have been looking at on a friend's server and google does not turn them up for me in Arch.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

iainmaoileoin
Posts: 16
Joined: Tue Jul 31, 2012 10:57 pm

Re: Thouhgts on backing up your SD card

Sun Dec 02, 2012 5:50 pm

I dont understand "Arch".
The pi I am on just now came from Element 14.
The image is "just whatever I found on the net".
The dump/restore commands have been in unix pretty close to forever - I must have used them in the 80s. They are pretty simple at one level using only inode dates and times - so that suggests they will be generally available?

How does "Arch" differ from

Code: Select all

uname -a
Linux raspberrypi 3.2.27+ #102 PREEMPT Sat Sep 1 01:00:50 BST 2012 armv6l GNU/Linux
I just used

Code: Select all

apt-get install dump
and thought nothing of it :mrgreen:

It is certainly nice to be able see the bits of "long forgotten" system files that you or or an install updated just before something started (or stopped) working.

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: Thouhgts on backing up your SD card

Sun Dec 02, 2012 11:06 pm

Arch is one of the other official distributions for the Pi, but it uses a different package manager, there is no apt-get, it uses Pacman.

I am hoping an Arch user will happen upon this query and answer my question.

I did appreciate seeing your thoughts and so have done some reading about dump and restore, I can see where they make more sense than the older tar which is what I have been using on my antiquated Embedded Linux system. It has neither dump nor restore on it.

I will be getting my Pi soon, but was curious now, before I get it installed, when those commands seem not to be on the mockup I have access to.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

Return to “General discussion”