From DD-WRT Wiki
Since samba2 has issues with files of size >2Gb and <4Gb and has no unicode support, 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!
Be sure to also check out the HDsamba script located in the forums if you want an all in one installation!
 Upgrading to Samba 3.5
Based on HDsamba2 update to samba3
- DD-WRT v24-sp2 SVN 14848 NEWD-2 K2.6 mini usb ftp (7/27/2010)
- DD-WRT v24-sp2 SVN 15962 NEWD-2 K2.6 Mega ((12/24/10))
- Frater's Optware the right way Versioned: Sat Jan 10 10:22:03 CEST 2011
- Install Frater's Optware the right way. Do NOT proceed any further if you haven't installed it successfully.
- Know how to use PuTTy , a portable Telnet/SSH program that does NOT need installation.
- Make sure SSH is enabled under the Services tab in the routers Web-Interface.
For users who don't know how to edit files with vi:
- On your computer create a network drive to your shared usb partition (ex 192.168.1.1/public). That way you can access and edit samba configuration files using your favorite text editor (ex wordpad).
 Let's begin!
Open Putty and make sure SSH is enabled on your router under Services -> SSH Management
Make a copy of smb.conf file and S80samba to a temporary location, we will edit those files later.
For vi users: cp /opt/etc/samba/smb.conf /opt/etc/samba/smb.conf.copy cp /opt/etc/init.d/S80samba /opt/etc/init.d/S80samba.copy For users who want to edit those files on their computers: cp /opt/etc/samba/smb.conf /mnt/smb.conf.copy cp /opt/etc/init.d/S80samba /mnt/S80samba.copy
Edit smb.conf.copy with your editor of choice and add the following line under the [global] section. Note: replace 192.168.1.1 with your router's ip address if different.
interfaces = 192.168.1.1/24
You smb.conf should look like this:
[global] server string = DD-WRT-NAS interfaces = 192.168.1.1/24 security = SHARE encrypt passwords = No log file = /opt/var/log/samba/log.%m max log size = 50 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 printcap name = /dev/null dns proxy = No wins support = Yes remote announce = 192.168.x.255 hosts allow = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 127.0.0.0/8
[homes] valid users = %S read only = No browseable = No
[printers] comment = All Printers path = /opt/var/spool/samba read only = No guest ok = Yes printable = Yes use client driver = Yes browseable = No [PUBLIC] path = /mnt valid users = www-data, nobody, root force user = root read only = No create mask = 0765 guest ok = Yes
Skip the following step if you used vi to edit your files. Otherwise if you used the network drive to access and edit smb.conf.copy, move the files somewhere safe as we're about to stop samba2 and unmount your usb drive.
mv /mnt/smb.conf.copy /opt/etc/samba/smb.conf.copy mv /mnt/S80samba.copy /opt/etc/init.d/S80samba.copy
Stop existing samba services.
service samba stop service samba off
Remove samba 2 and install samba 3.5 and SWAT
ipkg-opt remove samba2 ipkg-opt install samba35 ipkg-opt install samba35-swat
Copy smb.conf.copy and S80samba.copy back where they belong.
cp /opt/etc/samba/smb.conf.copy /opt/etc/samba/smb.conf cp /opt/etc/init.d/S80samba.copy /opt/etc/init.d/S80samba
Delete S08samba which was created by the Samba 3.5 install, as well as the S80samba.copy (or move it out of /opt/etc/init.d).
rm /opt/etc/init.d/S08samba rm /opt/etc/init.d/S80samba.copy
Restart samba services .
service samba on service samba start
Reboot, and enjoy Samba 3.5!
 Partition and format your USB drive
NOTE This does not pertain to frater's Optware, the Right Way
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 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
NOTE This does not pertain to frater's Optware, the Right Way
- Tested with Eko 24-sp2 (09/01/09) mini-usb-ftp - build 12774M NEWD. Also working on K2.6 kernel (13972 BS std-ftp-usb)
- 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/mounted.sh
- 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
- 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 wget http://www.3iii.dk/linux/optware/optware-install-ddwrt.sh -O - | tr -d '\r' > /tmp/optware-install.sh sh /tmp/optware-install.sh
It may be a good idea to set up a swap file
Create script file /mnt/mounted.sh with something like this:
#!/bin/sh mount /mnt/opt /opt sleep 2 cp /mnt/umount.sh /tmp/umount.sh chmod +x /tmp/umount.sh # /opt/bin/busybox swapon /mnt/myswap.swp /opt/etc/init.d/S08samba # if you can use IP machine identifications e.g. \\192.168.1.1\ uncomment the following # killall nmbd # 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. SWAT is Samba Web Admin Tool. You can use it at http://192.168.1.1:901/
Create script file /mnt/umount.sh with something like this:
#!/bin/sh #=========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 /mnt/umount.sh chmod +x /mnt/mounted.sh
 Install samba3
NOTE This does NOT pertain to Optware, the Right Way
wget -O /tmp/ConfSamba3.usb http://www.dd-wrt.com/phpBB2/download.php?id=11668 chmod +x /tmp/ConfSamba3.usb sh /tmp/ConfSamba3.usb
type ps in terminal to check out if processes smbd, nmbd and optionally xinetd are running.
You may tweak performance in the /opt/etc/samba/smb.conf file in this line
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
Bigger values for SO_xxxBUF usually mean slightly better performance. For D-Link_DIR-320, for example, increasing those values to 65536 gives 20% writing speed boost
You may check out resource consumption using top command.
If you don't need symbolic names and can use samba by IP address ( e.g. like \\192.168.1.1\data ) You do not need nmbd. So you may tweak scripts to not load it or to kill it right after it was loaded by /opt/etc/init.d/S08samba through killall nmbd