Backup

From Pandora Wiki
Revision as of 05:54, 21 April 2011 by ABC (talk | contribs) (formating)
Jump to: navigation, search

This page is a guide for those who have a working rootfs installed on an SD card, and wish to create an image of it (probably before doing something risky). The result is a tarball much like the one found at [1], but containing all of the user's libraries/apps/configuration etc.

Note that this isn't necessarily the best way to do it, but it is confirmed to work. Essentially all we're doing is storing the files of the rootfs in an archive using tar.

What you need

  • 1x SD Card (A) with the file system on it.
  • 1x SD Card (B) in which the image will be placed.
  • Time for compressing ( < 1 hour).

What to do

1) Boot up into an OS that isn't using the file system you want to back up (the default OS on the NAND works well for this).

2) Open up SD Card B in thunar, right click and select 'Open Terminal Here'.

3) In the terminal type:

sudo tar -cpjvf [chosenFileName].tar.bz2 /media/[label of SD Card B]/ --numeric-owner

Where the chosen file name can be anything you like and the label of SD Card B is (funnily enough) the label of SD Card B (default is mmcblk0p1 if in the left slot or mmcblk1p1 if in right slot) Example, for an image named 'myrootfs.tar.bz2', and SD Card B with the default label in slot one:

sudo tar -cpjvf myrootfs.tar.bz2 /media/mmcblk0p1/ --numeric-owner

For those that don't know what this is doing:

  • sudo (super user do) makes the command run with root privileges. This is important as many of the files in the rootfs will be protected from user access.
  • tar is the name of the program we're using to compress/store the rootfs
    • c is create a new archive
    • p is to ensure the permissions are kept the same. This is VERY important, some files require specific levels of privileges in order to work correctly. This is probably default when run with sudo, but it doesn't hurt to put it in.
    • j means use bz2 compression
    • v means verbose. This will spit out the file names that it's currently archiving to the terminal.
    • f is for file
    • --numeric-owner will store the owners of the files as numbers. I don't understand this, I read it here

That's it! The pandora will happily chip away at the file system for the next 45 minutes or so (I didn't stick around, but it was finished when I came back an hour late). To extract it the command is:

sudo tar -xpjvf [chosenFileName].tar.bz2 -C [destinationPath] --numeric-owner

For example, to extract my previous example into an SD Card with label 'devos':

sudo tar -xpjvf myrootfs.tar.bz2 -C /media/devos/ --numeric-owner

You can now go crazy with your opkg, safe in the knowledge a working copy is waiting for you when you inevitably type upgrade instead of update. Sigh.