My VoIP PBX (built on an embedded Linksys NSLU2) blew up tonight with a bad hard disk. Here’s the cheat sheet on how to recover it should it do the same next time.
- Replace the hard disk and reboot the NSLU2. Since the network settings are stored in flash, it will come up on the old IP even if the hard disk has failed.
- Format the new hard disk and partition it using
fdisk
. Swap space is recommended. Format it usingmkfs.ext3
. - Run
turnup disk -i /dev/sda1 -t ext3
to move the rootfs to the disk. - Reboot NSLU2 and install Optware as follows:
cd /tmp
wget http://ipkg.nslu2-linux.org/feeds/optware/slugosbe/cross/unstable/ipkg-opt_0.99.163-9_armeb.ipk
tar -zxvf /tmp/ipkg-opt_0.99.163-9_armeb.ipk
rm /tmp/debian-binary
rm /tmp/control.tar.gz
tar -ztvf /tmp/data.tar.gz
cd /
tar -zxvf /tmp/data.tar.gz
rm /tmp/data.tar.gz
cd /opt/etc
sed -i “s//stable//unstable/” ipkg.conf
/opt/bin/ipkg update - Restore old packages – namely,
xinetd
,net-snmp
,asterisk14
,tftp-hpa
,esmtp
, and all the things that asterisk recommends you install - Reconfigure
/opt/etc/xinetd.conf
to allow connections from the local LAN. - Restore data from backup – namely, the contents of
/opt/tftpboot
and/opt/etc/asterisk
- Create a startup script for Asterisk because it’s missing in the default package:
#!/bin/sh
if [ -z “$1” ] ; then
case `echo “$0″ | /bin/sed ‘s:^.*/(.*):1:g’` in
S??*) rc=”start” ;;
K??*) rc=”stop” ;;
*) rc=”usage” ;;
esac
else
rc=”$1″
fiASTERISK_DAEMON=/opt/sbin/asterisk
case “$rc” in
start)echo -n “Starting asterisk: ”
$ASTERISK_DAEMON 2>/dev/null &
echo ok
;;
stop)
if [ -n “`pidof asterisk`” ] ; then
echo -n “Stopping asterisk: ”
$ASTERISK_DAEMON -qrx ‘stop now’
sleep 1
echo ok
fi
;;
restart)
“$0” stop
sleep 1
“$0” start
;;
*)
echo “Usage: $0 (start|stop|restart|usage)”
;;
esac
Great article. The husband and I dumped landlines for voip about 2 years ago and haven't looked back since. Our friends are cell phone only but we only have prepaid so this works out. Thanks!