view · edit · print · history

How do I backup and restore on OpenSlug 3.1?

A short summary of what I did to create a backup of my slug (running on a 1GB flash stick) so I could restore the system on a spare flash stick .

This howto has been written by a Linux novice who moved from unslung because of stability problems. Most of the information is from other howtos on this Wiki, I've simply summarized it below – hopefully this will help other relative newbies (you probably need some *nix experience – but I guess if you got as far as running OpenSlug, you do)

A note of caution – I have tried this a few times without issue, but you might not be so lucky. Probably best not to try it on a system you cherish dearly !

A. Plug your extra memory stick into the spare usb port and configure it with an equivalent set of partitions to the main drive (the partitions don't have to be the same size, although you obviously want to make sure you have room to backup the files in each partition on the main drive):

Instructions on using fdisk are here: http://www.nslu2-linux.org/wiki/OpenSlug/InitialisingDisks

...don't go beyond the point where it describes 'Moving root file system'

B. Create a copy of your main drive using rsync – instructions are here: http://www.nslu2-linux.org/wiki/HowTo/BackupYourLinuxBox

I followed the config recommended in the Initializingdisks link, so my main disk is organized like this:

/dev/sda275288012796882Linux swap

and my backup:

/dev/sdb27118092455282Linux swap

I use the following commands to synchronise the data between the main and backup drive:

  1. rsync -rclpgovD --delete /opt /media/sdb3
  2. rsync -rclpgovD --delete --exclude-from=/root/backups/rsync-exclude /media/sdb1

notes: Note I couldn't figure out how to get rsync to use timestamps (errors about setting timestamps on some files),so I use the -c (checksum) option instead.

On my set-up backup partitions are mounted automatically (I don't really know what controls this in openslug) - if it doesn't happen on other installations you can add the mount commands to your backup script:

  1. mount /dev/sdb1 /media/sdb1

.. etc

C. Restore take out the main drive and plug the backup into port 1 - the slug should boot to flash.

Run turnup to copy the root file system to a partition on the backup drive:

  1. turnup disk /dev/sda1 -t ext3

Note : despite using a flash stick, I used 'disk' when I did the original installation on the main flash stick (if you used the 'memstick' option, you should think about use that option again in the restore) Note : don't use the -i (apparently this flag tells turnup you are starting with an empty filesystem and – hopefully – you aren’t)

.. that's it. Reboot and you should now be using your back up storage as the main drive. You will need to enable the swap partition:

  1. swapon /dev/sda2

D. If you are just testing your backup you can go back to the original main drive after the restore by:

  1. turnup flash
  2. reboot

.. and then repeat stage C. The lazy amongst you will have noticed you can do all of the testing without leaving your chair (just keep switching the ‘turnup disk’ instruction between /dev/sda1 and /dev/sda1)

Hope it helps

Nick, UK

view · edit · print · history · Last edited by nicka.
Originally by nicka.
Page last modified on July 21, 2006, at 01:34 PM