• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: How to backup an SD-card that contains a Root File System?  (Read 4795 times)
Heryro
Newbie
*

Karma: 0
Posts: 12


View Profile
« on: August 09, 2009, 04:15:02 AM »

Just followed the HowTo "SD Card As Root File System" on the Wiki.
Does anyone know how to make a backup of the sd-card?

P.S. The SD-card doesn't automatically mount on my Ubuntu-PC with Nautilus.
Other SD-cards are usually automatically mounted.
Logged

joosty
Newbie
*

Karma: 0
Posts: 26


View Profile
« Reply #1 on: August 09, 2009, 04:42:57 AM »

I tar the root fs every now and then (using cron) to an external location. If the SD card dies for example, I can easily recover by getting a new SD card, formatting in a similar way, and untar the backup on the new SD card.

Code:
tar cf /media/usbdrive/rootfs_backup.tar --exclude=/media --exclude=/lost+found --exclude=/proc --exclude=/dev --exclude=/sys /
Logged

Heryro
Newbie
*

Karma: 0
Posts: 12


View Profile
« Reply #2 on: August 09, 2009, 10:23:31 AM »

Thank you for your reply, it works great!

If I want to restore the original configuration, can I just format the card while it's active as the file system and then run
tar -xvpfz /media/usbdrive/rootfs_backup.tar -C /

Or are additional steps required?
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 443


View Profile WWW
« Reply #3 on: August 10, 2009, 02:58:58 PM »

I don't have mine yet (Fedex arrived with it today, but I wasn't in, so almost there).  But for a similar situation (an Asus wl500gx) I use rsync over a network to a USB drive on a PC (which is then backed up there, as well).
Logged

CqCn
Full Member
***

Karma: 0
Posts: 169



View Profile
« Reply #4 on: August 10, 2009, 04:01:00 PM »

Just followed the HowTo "SD Card As Root File System" on the Wiki.
Does anyone know how to make a backup of the sd-card?

P.S. The SD-card doesn't automatically mount on my Ubuntu-PC with Nautilus.
Other SD-cards are usually automatically mounted.
Heryro,  you may be interested in this new method I just posted:
http://plugcomputer.org/plugforum/index.php?topic=588.msg3491#msg3491
Logged

Cordially, CqCn

joosty
Newbie
*

Karma: 0
Posts: 26


View Profile
« Reply #5 on: August 13, 2009, 12:42:16 AM »

Thank you for your reply, it works great!

If I want to restore the original configuration, can I just format the card while it's active as the file system and then run
tar -xvpfz /media/usbdrive/rootfs_backup.tar -C /

Or are additional steps required?
No additional steps necessary, just untar it onto a similarly formatted SD card and you're ready to go.
Logged

restamp
Global Moderator
Sr. Member
*****

Karma: 4
Posts: 273


View Profile
« Reply #6 on: August 13, 2009, 08:44:00 AM »

Actually, I think there may be a minor problem with this approach -- well, a couple actually:

When I first added my SDcard, I copied the NAND root FS onto it essentially the same way.  (Actually, I used something like "find / -mount | cpio -pdm /mnt/sdcard".)  However, I found after I did this, I couldn't boot from the SDcard.  The problem turned out to be that the kernel really does need a couple of the entries in /dev, like /dev/ttyS0, early-on in the boot process.  These must exist in the /dev on the root FS, even though /dev is later overlayed by the pseudo-fs udev that the kernel uses to create its device hierarchy.  Thus, I'd advocate just including the entire /dev to your backup:  You'll get more than you need, but it really doesn't take up much room.

The other problem I see with this approach is that it only works for fs's that are less than about 50% full.  For those that are greater than that, you'll run your root fs out of space doing the backup.  One workaround is to use nc.  On the remote backup site -- let's call it "mydesktop" run:
Code:
nc -lp 2345 >MyPlug.backup.cpio
then on your Plug run (as root):
Code:
cd / && find . dev -mount | cpio -oc | nc mydesktop 2345
It takes about a minute to backup my Plug over my local LAN using this method, and the backup is "offsite" to boot!

If you'd rather create a complete hierarchical subdirectory on the backup site -- or, say, replicate one Plug's fs on another's -- instead of the initial "nc" above, you could use something like:
Code:
cd /mountpoint && nc -lp 2345 | cpio -idm

(You can no doubt translate the above cpios into tar commands, too.  I use cpio, since that is the backup tool I was raised with.)

YMMV
Logged

Pages: [1]
Print
Jump to: