Welcome to the new location of Alien's Wiki, sharing a single dokuwiki install with the SlackDocs Wiki.
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | linux:slug [2009/11/15 13:54] – Formatting alien | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== A backup server using NSLU2, unslung and rsnapshot ====== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | In a [[: | ||
+ | |||
+ | This article however, will show you how you can use a cheap off-the-shelf NAS (//Network Attached Storage//) plus a big external USB hard disk to build a // | ||
+ | |||
+ | The hardware & software I used to build my backup server are: | ||
+ | |||
+ | * LinkSys NSLU2 //NAS// (commonly called a //slug//) | ||
+ | * External USB 2.0 hard disk enclosure with 1 TB disk storage | ||
+ | * USB Flash drive with 1 GB storage | ||
+ | * [[http:// | ||
+ | * The uNSLUng [[http:// | ||
+ | |||
+ | The NSLU2 is a small and silent, //ARM CPU// powered network storage server that does not have disk storage built in - you need to attach one or two external USB hard drives to it's USB connectors on the back. It is one of the many relatively cheap solutions for out-of-the-box network storage demands. It has a spartan administrative user interface, and is not customizable. However, it's firmware is built on Linux so the source code modifications have been made available to the public. Initially, there was only the " | ||
+ | |||
+ | Below you find the steps I took to add extra functionality to the NSLU2. | ||
+ | |||
+ | ------------------------------------------------------------------------ | ||
+ | |||
+ | ==== Choice of firmware ==== | ||
+ | |||
+ | You can find a good overview of available alternative firmwares for the NSLU2 on the [[http:// | ||
+ | |||
+ | |||
+ | ==== Hardware considerations ==== | ||
+ | |||
+ | The original NSLU2 firmware from LinkSys allows you to add at most two external USB storage devices to the connectors at the back. The alternative firmwares like //unslung// allow you to add a USB hub to "Port 1" and therefore, connect more than two storage devices.\\ However, the //unslung// firmware uses one of the external USB devices as the //root device// where it will install additional software. You will have to make a judgement call on whether you want the unslung packages and configuration files to be stored on the same disk as where your backup data is going to accumulate.\\ In particular, if you want to be able to remove your external hard drive from the NSLU2 and use that on another computer, the disk must not contain //unslung// configuration data or else your NSLU2 with //unslung// will not reboot properly! | ||
+ | |||
+ | There are some articles on the [[http:// | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | What I decided, is to plug a //1 GB USB flash drive// (the minimum required storage for an unslung root device is 512 MB) into //Port 2// of the NSLU2 and use that as the root device for " | ||
+ | |||
+ | To //Port 1//, I have attached an external USB //1 TB hard disk//. This device has been manually formatted as and //ext3// filesystem using the //'' | ||
+ | |||
+ | |||
+ | ==== Administrative access to the NSLU2 ==== | ||
+ | |||
+ | The firmware that ships with the NSLU2 does not have a telnet server. The only management interface is the web interface.\\ | ||
+ | The NSLU2 will start out of the box on IP address "'' | ||
+ | |||
+ | Once you flashed the NSLU2, you will have to enable the telnet server of the //uNSLUng// firmware before you can do anything else (do not attach any external storage yet!). The default // | ||
+ | |||
+ | |||
+ | ==== Flashing new firmware ==== | ||
+ | |||
+ | In order to flash a NSLU2 with custom firmware you will have to install the [[http:// | ||
+ | The upslug web page explains the flashing process. Basically, you will have to put your NSLU2 in "// | ||
+ | - Shutdown the slug | ||
+ | - Using a paper clip (or pushpin), push and hold in the reset button. (The reset button is located on the back of the NSLU2 above the power connection.) | ||
+ | - While holding in the reset button, press and release the power button. | ||
+ | - Watch the orange Ready/ | ||
+ | - You should be in upgrade mode which is indicated by the Ready/ | ||
+ | |||
+ | This is how the process looks from the command line. Make sure you have the upslug2 binary in your '' | ||
+ | < | ||
+ | $ upslug2 --device eth2 --verify --image Unslung-6.10-beta.bin | ||
+ | |||
+ | NSLU2 | ||
+ | Firmware Version: R23V29 [0x2329] | ||
+ | |||
+ | Upgrading LKG634B67 00: | ||
+ | </ | ||
+ | |||
+ | <note warn>Do not turn off the NSLU2 while you are flashing it! Also do not try to use a wireless network connection for this.</ | ||
+ | |||
+ | |||
+ | ==== Unslinging to flash device ==== | ||
+ | |||
+ | After flashing with new firmware, enable the telnet server, login as //root// and while logged on perform the "// | ||
+ | |||
+ | * Plugin a flash disk (512MB or larger) into the "'' | ||
+ | * In the Web GUI, [[http:// | ||
+ | flash disk is detected, and let the NSLU2 format it. After formatting it must display as "'' | ||
+ | * In the telnet session (stay logged in!) enter < | ||
+ | * Afer the // | ||
+ | Leave the device disk2, /dev/sda1, plugged in and reboot | ||
+ | (using either the Web GUI, or the command " | ||
+ | in order to boot this system up into unslung mode. | ||
+ | </ | ||
+ | |||
+ | ==== Additional packages ==== | ||
+ | |||
+ | After // | ||
+ | * openssh, rsnapshot, cron, syslog-ng, util-linux, less, e2fsprogs, nfs-utils, man, screen, procps, sendmail, logrotate, nail < | ||
+ | # ipkg update | ||
+ | # ipg list | ||
+ | # ipkg install openssh | ||
+ | # ... etc ... | ||
+ | </ | ||
+ | |||
+ | This will automatically install the dependencies as well: | ||
+ | * for openssh : openssl, zlib | ||
+ | * for rsnapshot : coreutils, perl, rsync, openssh | ||
+ | * for syslog-ng : glib, eventlog | ||
+ | * for util-linux : ncurses (actually it is a ' | ||
+ | * for less : ncursesw | ||
+ | * for e2fsprogs : e2fslibs | ||
+ | * for nfs-utils : portmap, e2fsprogs | ||
+ | * for man : groff, less | ||
+ | * for screen : termcap | ||
+ | * for procps : ncurses | ||
+ | * for sendmail : procmail | ||
+ | * for logrotate : popt | ||
+ | * for nail : openssl | ||
+ | You can list dependencies with a command like this:< | ||
+ | # ipkg info openssh</ | ||
+ | |||
+ | You need to re-login to make the new binaries in ''/ | ||
+ | |||
+ | After installing OpenSSH, the sshd daemon is running. Verify that you can login and then disable telnet through the GUI: [[http:// | ||
+ | |||
+ | |||
+ | ==== Configuring rsnapshot ==== | ||
+ | |||
+ | * Configure the remote '' | ||
+ | / | ||
+ | </ | ||
+ | # ssh rbackup@192.168.1.77 | ||
+ | </ | ||
+ | bash: line 1: / | ||
+ | Connection to mycomp.mylan.lan closed. | ||
+ | </ | ||
+ | Rejected 3 | ||
+ | Connection to mycomp.mylan.lan closed. | ||
+ | </ | ||
+ | |||
+ | * Copy the '' | ||
+ | # cp / | ||
+ | |||
+ | * Edit the configfile and check for correct syntax: < | ||
+ | # / | ||
+ | |||
+ | * After plugging in the big drive into port "// | ||
+ | # umount / | ||
+ | # mkfs.ext3 -m 0 /dev/sdb1 | ||
+ | # tune2fs -c 0 -i 0 / | ||
+ | |||
+ | * Make a root directory for the snapshot backups at < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | * Add the following line to ''/ | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | * For ordinary users to access their backups // | ||
+ | # mkdir / | ||
+ | </ | ||
+ | # chmod 0700 / | ||
+ | # chmod 0755 / | ||
+ | # chmod 0755 / | ||
+ | </ | ||
+ | / | ||
+ | </ | ||
+ | localhost:/ | ||
+ | </ | ||
+ | / | ||
+ | </ | ||
+ | # mount / | ||
+ | |||
+ | * In ''/ | ||
+ | |||
+ | * Add these lines to root's crontab (crontab -e) so that daily and weekly snapshots are being generated (you can add more as desired, and at other times of course): < | ||
+ | 30 23 * * * / | ||
+ | 0 01 * * sun / | ||
+ | </ | ||
+ | |||
+ | <note warn> I have not managed to make the //slug// send me emails yet ... If anyone knows what I missed, let me know on the discussion page</ | ||