Repair broken disk on NSLU2



One of the USB disk drives on my Linksys NSLU2 suddenly stopped mounting and showed Unformatted on the Status screen. I have a Mac where I can plug in the USB drive, but MAX OSX Tiger does not support the existing ext3 file system driver, I cannot access the disk there. I did find out that the conf partition was broken, the data partition seemed OK.
I did not want to reformat the disk without first having a chance to save the data on it. The following steps show how to hack yourself into the NSLU2 from a Mac computer and re-enable access to the disk:

  1. First enable telnet access:
    1. Boot the NSLU2 with a working hard disk connected t0 USB 1 and the broken disk to USB 2.
    2. On the Administration->Backup web page, click on the “Download” button in the “Config Backup” section
    3. Save the file as config.bin.tar.
    4. On a command prompt enter the command tar xf config.bin.tar.
    5. Edit the file config/hdd/passwd and delete the password for root (the second field in the line starting with root).
    6. Enter the command tar cf config2.bin.tar config.
    7. On the Administration->Backup web page, click on the “Upload” button in the “Config Backup” section and select the file config2.bin.tar for upload.
    8. The NSLU2 will reboot.
    9. Goto the /Management/telnet.cgi page on the NSLU2 and enable telnet.
  2. Telnet to the NSLU2 and login as root.
  3. Enter the command mount /dev/sdb1 /share/flash/data.
    Now ls /share/flash/data should show you the content of the disk. You may need fsck.ext3 /dev/sdb1 to repair problems.
  4. Add the following lines to /etc/samba/smb.conf:
    [ADMIN 2]
    valid users=@"administrators"
    comment=
    path=/share/flash/data/
    read only=yes
    write list=@"administrators"
    [DISK 2]
    valid users=@"administrators",@"everyone",@"linux"
    comment=For everyone
    path=/share/flash/data/public/
    browseable = yes
    read only=yes
    write list=@"administrators",@"everyone",@"linux"

    This makes the disk available for sharing via Samba.
  5. Enter the command /etc/rc.d/rc.samba restart.
    This restarts the Samba daemon to force it to read the updated configuration file.
  6. Now you can access the disk again on another computer via Windows file sharing.

Leave a Reply