From DD-WRT Wiki

Revision as of 15:54, 17 November 2009 by Baltico (Talk | contribs)
Jump to: navigation, search

Since samba2 has issues with files of size >2Gb and <4Gb you may want to use samba3. It is more resource consuming though, and you probably will need a swap if your router has less than 32Mb RAM or running other RAM consuming programs

Partition and format your USB drive

You need to first partition and format your drive

This can be done by attaching the drive to an other system like:
  • a PC running linux (maybe from a LiveCD)
  • a Windows PC using a partitioning tool
  • a windows PC with VirtualBox running a Linux guest system
  • Some have been able to use their iPod.

First partition on your drive needs to be ext2 or ext3. ext3 is more fault tolerant, so could be a better choice in general.

For use with Eko Mini_usb_ftp, the first partition needs to to be ext3,
for use with Mega builds, the first partition can be formatted as ext2 or ext3

You do not need more than one partition on you USB drive to use Samba3, but you may also use it with a three partition drive, as is common place when used with a HD.

Prepare for samba3

  • Tested with Eko 24-sp2 (09/01/09) mini-usb-ftp - build 12774M NEWD.
  • For Mini_usb_ftp version your partition must be ext3
  • For Mega version your partition can be either ext2 or ext3

Enable USB in web-GUI and set

enable USB1.1, USB2 as neded for your router and usb drive
enable "USB Storage Support"
enable "ext2 / ext3 File System Support"
enable "Automatic Drive Mount"
set "Run-on-mount Script Name" to /mnt/
set "Disk Mount Point" /mnt

For good meassure you should also set shutdown commands in web-GUI

tab: Administration -> tab: Commands -> text field: Commands ->
write this line
 sh /jffs/usr/bin/unplug.usb
Click "Save Shutdown"

Prepare your router to install Optware For simplicity you may just create folder /mnt/opt and in terminal run

mount /mnt/opt /opt 

It is a good idea to set up a swap file

Create script file /mnt/ with something like this:

mount /mnt/opt /opt
sleep 2
/bin/sh /opt/etc/init.d/S08samba 
# if you need SWAT, uncomment the following^
#/bin/sh /opt/etc/init.d/S10xinetd 

It will launch samba daemon automatically every time after disc mounting

Create script file /jffs/usr/bin/unplug.usb with something like this:

#=========stop samba============
echo "Stopping smbd:"
killall smbd
echo "Stopping nmbd:"
killall nmbd
#==========stop xinetd==========
echo "Stopping xinetd:"
killall xinetd 

make both scripts executable

chmod +x /jffs/usr/bin/unplug.usb
chmod +x /mnt/

Install samba3

wget -O /tmp/ConfSamba3.usb
chmod +x /tmp/ConfSamba3.usb
sh /tmp/ConfSamba3.usb

type ps in terminal to check out if processes smbd, nmd and optionally xinetd are running.

You may tweak memory consumption int /opt/etc/samba/smb.conf file in this line

	socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 

But it has strong effect on performance.