Welcome!

Thanks for visiting. If you found this information interesting or useful (or you think I'm dead wrong about something) I'd like to invite you to leave a comment on this post. You can also subscribe to my RSS feed or sign up for email updates on the right-hand side of the page.

If you Digg what you StumbleUpon, find my writing del.icio.us, or are one of the Technorati, you know what to do:

Backing up OpenWRT

I recently got a Linksys WRT54GL router, and I installed OpenWRT, an open-source Linux firmware. But I ran into a sticky problem - how do I back it up? Using scp doesn’t work because scp doesn’t have a way to ignore symlinks. Heavier tools (like rsync) would be great, but they are too heavy for a tiny embedded system like this. This might seem obvious to some, but this way worked quite well:

ssh user@domain.com "tar cv /bin /etc /lib /sbin /tmp /usr /www" > openwrt.tar

Why not gzip the output? Well, remember that the WRT54GL is a tiny embedded system - 16M of RAM and 4M of flash memory. You can’t zip the whole thing up because piping tar to gzip on my router because it would use up all of the available free RAM. By only using the bare minimum (tar) you can successfully get this to run in about 600K of free memory.

Why enumerate all of those folders? OpenWRT routers have /jffs and /rom, among other things, which are overlayed to give you the image you have of the root filesystem. Excluding those (and /dev and /proc) skips a lot of unnecessary file copying.

The resulting file size was 6.5M, and when gzipped it was 2.6M, which agrees quite well with the 2.9M that I expected based on the disk usage in the compressed JFFS filesystem.

I’m planning an extensive “Asterisk on WRT54GL” tutorial soon, so if you’re interested in what you can do with a little bit of Linux and a tiny, in-expensive wireless router, check back with me in a few weeks.

Related posts:

  1. Koine Greek in Ubuntu Gutsy Gibbon Here's the simple process for installing Koine Greek input method...
  2. Reliable InnoDB hot backups There are number of blog posts out there that mention...

Leave a Reply