NSLU2-Linux
view · edit · print · history

Backing up changes

ReSling is a useful script if you want an easy way for backing up files you have modified. It saves all files which are in the /unslung/ directory and puts them in a .tar.gz file. The file is saved on the first data partition it finds.

Its also possible to save files or directories which are not in /unslung by adding them to the file /unslung/.files (one file or dir per line!)

usage:
resling start|clear|load|list|save

  • start
extracts the resling.tar.gz file to the root filesys.
  • clear
deletes the resling.tar.gz on the first data partition.
  • load
extracts the resling.tar.gz file to the root filesys and lists the extracted files.
  • list
lists all files and dirs which are saved in the resling.tar.gz file on the the first data partition.
  • save
backups the files and dirs in the /unslung dir and everything which is in the .files file and puts it in the file resling.tar.gz on the the first data partition.

sample file /unslung/.files

/opt/sbin/ipkg-load
/opt/etc/vsftpd.conf
/etc/crontab
/etc/shells
/etc/passwd
/etc/group
/usr/local/passwd
/usr/local/group
/home/httpd/html/Management/.htpasswd


Finding changed files on the root file system

If you have not installed Busybox 1.0, you can install findutils and easily find which files have changed on the flash.

If you have unsling'ed to a hard drive, my suggestion (which is a huge hack that will make me enemies across the globe) is that you do in fact install Busybox 1.0, but mark it as not installed in the ipkg status file (just delete the Busybox 1.0 section in /share/hdd/data/usr/lib/ipkg/status). Whenever there is a conflict with other packages (will be reported a bit strangly as file conflicts with the package itself), delete the conflicting Busybox links and retry the installation until it succeeds. This way the Busybox 1.0 applets will supplement whatever other packages you install, but will never stand in the way for installing packages that conflicts with it. At some ideal point in time, you will have no need for Busybox 1.0 at all in that all the applets have been replaced with proper utilities.

 ipkg install findutils
 find / -mount -newer /unslung/.files > /tmp/resling.list.txt

which will produce a list of all changed files and directories on the root/flash file system since the last modification of the resling file list. If you haven't created the /unslung/.files list yet, the find-command should rather read find / -mount. This will list all files on the root/flash file system for you to go through.

Just bring it into your editor and remove irrelevant changes to the flash file system, leaving the files you want to resling. Finally you add them to your /unslung/.files and delete the temporary file you created. And... remember to add the /unslung/.files to itself, or better still (since /unslung is not a link to the hard drive but a directory on the root flash file system) add /unslung to it by doing echo "/unslung" >> /unslung/.files. Otherwise you will have to recreate /unslung/.files after every firmware upgrade (not that difficult - just do tar tvzf /share/hdd/data/resling.tar.gz > /unslung/.files to duplicate the file list and edit the result for links).

 cat /tmp/resling.list.txt >> /unslung/.files
 rm /tmp/resling.list.txt

Bob_tm


btw: the ipkg-load script helps to reinstall all your packages.

ipkg-load:

#!/bin/sh
ipkg update
ipkg install -force-overwrite <YOUR PACKAGES SEPERATED BY SPACE e.g. zlib openssl atftp ntpclient nfs-utils vsftpd>


A handy hint so you don't get caught out like I did... Double check where the saved resling.tar.gz gets sent to. It defaults to /share/flash/data if you don't have one already in /share/hdd/data, which gets lost on reboot if this filesystem isn't mounted. So when you run "resling save" copy the file to the mounted filesystem you want to, then future reslings will work correctly.

view · edit · print · history · Last edited by Thomas.
Based on work by bobtm, tonymy01, Vasile Dumitrescu, and az_707.
Originally by rwhitby.
Page last modified on August 29, 2006, at 01:00 AM