Різне

USB storage, DD-WRT Wiki

21.02.2017

[edit ] USB storage

[edit ] Applications

  • The use of a USB -compatible router makes the SD/MMC modification unnecessary. Just drop any old digital camera card into a USB flash card reader and easily expand the storage space of your Linux-based router. Any of the various card types, including CompactFlash and SD, are suitable. USB flash devices are also available as one self-contained unit: a small «tag» which can store up to several gigabytes of data.
  • A USB hard drive can be used as network-attached storage, shared by all computers on a LAN using SSH (scp), FTP, Samba або NFS. Most standard internal hard drives (notebook or desktop) can be converted by simply installing them in an inexpensive USB enclosure.
  • A USB hard drive can also be used as virtual memory creating by swap space. Instead of abruptly running out of memory when the 32Mb of physical RAM in these units is full, a portion is swapped to disc and the applications continue to run by, but with a speed penalty.
  • Mounting a USB storage device as /opt provides nearly-unlimited space to install many applications from the large collection of Optware packages, ported to embedded Linux originally for use with the Linksys «slug» (NSLU2) USB network-attached storage servers. A USB-compatible router can provide pretty much all of the NSLU2’s capabilities (at a comparable price) plus offer all of the capabilites of a standard router and a wireless access point.

The use of standard USB hubs allows other USB devices (such as printers, serial ports, CD/DVD drives and audio) to remain connected even while the USB interface is used for flash cards or hard drive interfaces.

[edit ] Compatible units

This is not a comprehensive list of Supported Devices. just a few which support USB:

Note: The Asus WL-520GU requires the use of the usb-ohci driver. Using the ehci-hcd driver will identify and find USB storage devices, but reboots the WRT every time you try to access the storage. See this OpenWRT forum discussion for more information. These issues seem to have been resolved on the newest v24_TNG versions — See this forum thread: USB on BCM5354 routers — need testers Fixed as of V. 24sp2

[edit ] DD-WRT versions with built-in USB support

  • As of v.24 USB support is included via the web-GUI in the Mega versions of dd-wrt.

Note: v.24 x86 version of dd-wrt does not yet have USB support built in to the web-GUI

  • Eko has the expanded USB options of DD-WRT v24_TNG versions (TNG = The Next Generation = V24-preSP2): http://www.dd-wrt.com/dd-wrtv3/dd-wrt/downloads.html

(under ‘others ‘, ‘Eko ‘, ‘v24_TNG ‘ from svn10137 or later) (from version v24_TNG-svn11218 USB and NAS (ftp) seems to be working smoothly, both in the new Mega (for 8Mb Flash routers) and new Mini_usb_ftp (for 4Mb flash Routers) ) (Early v24_TNG versions only works with one USB drive. As I was testing svn11536 I noticed that several USB drives were now automatically detected correctly. Though the plug-in of a second drive did seem to confuse the «Run-on-mount» settings — your mileage may vary).

  • At one point there were issues on new routers using the BCM5354 CPU, these issues seem to have been resolved on the newest v24_TNG versions — See this forum thread USB on BCM5354 routers — need testers
  • User lightix has prepared a proof of concept micro_plus_usb_asus520gc.bin version that combined with mega.tar.gz unpacked on a USB drive, gives the option to run DD-WRT Mega on routers with as little as 2Mb FlashRAM and a USB stick. Read more about testing this concept at this English and this forum Ukrainian forum

Note: V24_TNG-svnxxxxx are pre-SP2 development versions of dd-wrt. For the most part they work just fine — and they have the new USB and NAS functionality. However: they are still development versions. Generally speaking, if you need the new USB and NAS functionality, you should install the version with the highest recommended svn number. See Peacock Forum Thread (note 3) for current recommendations.

[edit ] Step 1 — Partition and format your USB drive

NOTE — The following information is very outdated and pretty much useless for К26 capable routers. It is recommended that you read Optware, the Right Way before you continue!

You need to first partition and format drive your

This can be done by attaching drives the to an other system. Like a PC running linux (maybe from a LiveCD) or from a Windows PC using a partitioning tool. Some have been able to use their iPod.

You can format your partitions to either ext2/3 or FAT32.

Use ONLY ext2/3 for partition/drives that you plan for permanent connection to your DD-WRT box, or for drives where you plan to install additional software packages onto (like optware, Samba, Torrent etc.). You can use any of the three mount points: /opt, /mnt, /jffs

Use FAT32 on data partitions if you intend to connect this drive to other systems (MAC, Windows) to copy files from/to directly. You should use the mount point: /mnt

For USB flash drives it is recommended to use ext2 або FAT32. The journaling system of ext3 file system on USB flash drives will add to write-wear of the flash chip.

Note: for EKO v24TNG-svn11218 Mini_usb_ftp — does not support ext2 formatted partitions.

For large HD drives that you «permanently» attach to your router you may want to consider creating three or four partitions:

  • one: for optware packages — make it 32MB — 2GB — use ext2/3 as the format
  • two: for swap file — make it 16-256 MB — format it as linux swap file
  • three: for data space — make it fit the rest of the disk — use ext2/3 or FAT32 as the format
  • four: for jffs space — make it 32MB — 2GB — use ext2/3 as the format

Note: With the third partition being the data space, your HD drive will work with the SlimSamba2 and HDsamba2 scripts described below.

[edit ] Step 2 — USB Connect the drive to your DD-WRT box

Plug in the freshly partitioned and formatted USB drive to you dd-wrt box!

[edit ] Step 3 — Enable USB support on the Mega / Mini_USB version of DD-WRT

Using the Web-GUI to enable USB support select:

Note: as of version Eko V24TNG-svn11205 USB and NAS (ftp) has their own sub-tabs under the Services tab Services -> Services -> USB support: Core USB support = enable

Enable one or both of the following if you want to use USB 1.1 devices

  • USB 1.1 Support (UHCI)
  • USB 1.1 Support (OHCI)

Note: The Asus WL-520GU requires the use of the usb-ohci driver. Using the ehci-hcd driver will identify and find USB storage devices, but reboots the WRT every time you try to access the storage. See this OpenWRT forum discussion for more information. Fixed as of v.24sp2

Enable the following if you want to use USB 2.0 devices

  • USB 2.0 Support (EHCI)

Enable the following if you want to access USB hard disks or USB flash drives

  • USB Storage Support = enable

Activate one or more file systems to be able to access on the storage devices

  • ext2 / ext3 File System Support
  • FAT File System Support

NOTE: not all dd-wrt versions have embedded filesystems support (Although these options are accessible via WEB-interface). If your hardware has flash 4MB or less — it may not include filesystems kernel modules. Try to your search filesystem for files ext2.ko, ext3.ko, vfat.ko and so on. If they are absent, your system doesn’t support filesystems and you need some kind of trick Mounting_USB_drive_without_located_onboard_fs_modules .

Enable the following if you want to access USB printers attached to the DD-WRT mega/usb loaded router over the network

  • USB Printer Support

As of EKO build V24TNG-svn11100 the following options are also available:

Note: as of version V24TNG-svn11205 USB and NAS (ftp) has their own sub-tabs under the Services tab

[edit ] Prevent Harddisk Spindown

This is a common issue and is easily mitigated by the following commands (used through an Unbuntu Linux Distro). Replace the. with appropriate drive letter

Example Only:

You’ll get an output like this:

You want to change STANDBY to 0 (this will also make SCT 0, I believe the 9000 is how many seconds until it spinsdown)

Run the following commands:

The output now looks like this:

Edit: You can use something like /dev/scsi/host0/bus0/target0/lun0/disc for device name on dd-wrt. To revert STANDBY changes use this:

[edit ] Step 4 — Enable Network Access

After activation of USB storage support, you need to select one or more ways to access the USB drive space over the network. You have several options, and you can select one or more of these options.

Using SSH (and WinSCP) has been an option for a long time with dd-wrt.

As of EKO V24TNG-svn11218 dd-wrt also has a built-in FTP server option.

This guide will also show some options of using Samba and NFS to enable Network Access to the drivespace of your DD-WRT system.

Note: V24_TNG-svnxxxxx are pre-SP2 development versions of dd-wrt. For the most part they work just fine — and they have the new USB and NAS functionality. However: they are still development versions. Generally speaking, if you need the new USB and NAS functionality, you should install the version with the highest recommended svn number. See Peacock Forum Thread (Note 3.) for current recommendations.

[edit ] Network Option A — Use SSH (SCP) and WinSCP

One advantage of using SSH and SCP protocol to access your files is that passwords and data are encrypted during transfer network.

In the web-GUI select:

tab: Services -> tab: Services -> section: Secure Shell -> option: SSHd = enable Click «Save» and «Apply Settings»

You can now access the file system using the SCP protocol.

To open for WAN access to your files using the web-GUI select:

tab: Administration -> tab: Management -> section: Remote Access -> option: SSH Management = enable Click «Save» and «Apply Settings»

File manager programs for using SSH (scp)

  • WinSCP is an open source file manager for windows.

WinSCP quick user guide: Hostname would be the URL or IP number of your router. User name is you «root» and «root password». Select the SCP protocol. Ignore the two warnings about group when first accessing your router.

You will start in the /tmp/root folder, move to the /mnt, /opt or /jffs folder (as set on your USB tab in the web-GUI), to access your USB drive.

[edit ] General intro to the dd-wrt folder structure

All folders in the root (/) is basically read-only, until you mount one of the folders on a read-write-able (rw) enabled drive.

  • /tmp is mounted on the RAM drive of dd-wrt.

Special folders are /jffs, /opt, /mnt and /mmc. These folders have special dd-wrt uses, and the special functionality and special hardware can be activated using the web-GUI. Due to the nature of Linux any folder can also be mounted/re-mounted on any other drive/sub-folder in the system, but to use these options you should know what you are doing.

  • /jffs is usually mounted on the «left-over» built-in flash space, and is usually activated in the web-GUI. See Jffs
  • /mmc is usually mounted on SD Flash Ram cards of a SD/MMC-mod. and is usually activated in the web-GUI.
  • /opt is usually mounted anywhere on a writeable drive with enough space, and is mainly needed for use with the Optware package system
  • /mnt can be used for any rw drive, and does not yet have any specific functionality in the web-GUI connected with it.

Linux/dd-wrt «commands» can be found in /bin, /sbin, /usr/bin and /usr/sbin

You can also read more about using WinSCP with DD-WRT on the WinSCP wiki page.

[edit ] Network Option B — Use NAS (FTP)

As of version Eko V24TNG-svn11218 dd-wrt Mega and Mini_USB has a built-in FTP server option.

In the web-GUI select:

tab: Services -> tab: NAS> section: ProFTPD -> option: ProFTPD = enable option: Server Port — 21 — is recommended option: Files Directory — /mnt — is recommended, but should just be the same as set in the USB tab. option: Allow Write — enable — is needed if you want to be able to FTP-write to the drive option: User Password List -> any name [space] password can be entered Name and password must be separated by a space. You should enter at least one user name and password. so you do not need to use the «root user» to get FTP access. Click «Save» and «Apply Settings»

And now you should have FTP LAN access to your USB drive

[edit ] FTP Option — allow WAN FTP access

To allow WAN access using FTP protocol run the following line in a terminal window:

Note: FTP is a clear text protocol, so your FTP username and password can be sniffed, so you should think twice before enabling WAN FTP access.

[edit ] FTP Option — allow anonymous FTP access to all or part of the USB drive

allow You can anyone on your LAN to read all or a specific folder-tree on your USB drive. If you enable WAN access, the anonymous settings will also apply to all WAN users ( = all of the internet users )

option: Anonymous Login (Read-only) — can be enabled if you want anyone to be able to read files on your USB drive. option: Anonymous Home Sub-directory — can be set to a sub-folder where you keep your public files and folders, like: /mnt/public ( in Anonymous Home Sub-directory text field write: /public )

Anonymous example — you must create the public folder in a terminal or using the normal FTP user.

In Anonymous Home Sub-directory text field write: /public Click «Save» and «Apply Settings»

[edit ] Network Option C — Use Samba and Windows Network Neighbourhood

Samba is the Linux tool for sharing drives with Windows (and MACs and Linux) over the network using the SMB protocol ( = Windows Network Neighbourhood).

  • Check out the Optware tutorial for standard Samba options.
  • forums.slickdeals.net also has a very extensive write-up of installing Optware Samba and using USB drives.
  • See Links section for even more examples.

[edit ] Samba2 the easy way

  • Slim Samba2 — A quick, easy and slim version of Optware Samba2.
  • For easy use on a USB flash drive (or USB HD), it can be installed using the web-GUI and just four CLI commands.
  • You may even unpack the Slim Samba2 files on the USB drive, while it’s still attached to the Linux system you use to the format drive with. Then adjust settings in the web-GUI, plug-in the USB drive to your router, and you are up and running.
  • If you are new to dd-wrt or Linux this may be a good place for you to start.

Slim Samba2 can be used with any USB enabled firmware newer than Dec. 17, 2008 (svn 11218).

  • HDsamba2 is an easy to use install and boot script system that will:
  • check your setup,
  • download needed OpenWRT and Optware packages,
  • install and trim settings so your USB drive, dd-wrt, jffs drive and Samba2 with SWAT will all
  • be up and running in a matter of minutes.
  • HDsamba2 boot script helps you maintain pristine data integrity of your USB drive.

HDsamba2 can be used as is with any USB enabled firmware newer than Dec. 17, 2008 (svn 11218). Some users have also used it with V24SP1 firmwares.

[edit ] Updated Instructions

I found a great guide here, but even it’s not entirely up to date with what I have in one of the latest builds (r25760). So here is a set of simplified instructions to help another newb (like me!) get started.

To enable USB: — go to Services > USB — Enable «Core USB Support»; this will open up some new options — Enable «USB Storage Support» — Enable «Automatic Drive Mount» — Enable «Use SES Button to remove drives» (optional) — click Save

Plug in your USB storage device. Wait for it to appear in the Disk Info area. Note the mount path (likely /tmp/mnt/sda1).

To enable access to your USB device on your Windows network: — go to Services > NAS — Enable «Samba» — enter your Windows «Workgroup» name — under «File Sharing > Shares» click Add Share — select the «Path» (likely /mnt/sda1) — give your USB device a «Name» — under «File Sharing > Users» click Add User — enter a «User Name», «Password», and select the name of the device you added above under «Access Shares» and then «samba» — click Apply Settings

Open Windows Explorer and go to Network, where you should see now a «dd-wrt» entry. When you click it, you will be prompted to enter the User Name and Password you created in Services > NAS above. Click OK and you should have access to your USB storage device. You could either map this as a network drive (right-click and select «Map network drive»), or add it to your Favorites (right-click Favorites at the top of the Windows Explorer tree and select «Add current location to Favorites»).

Not a command line entry or package to compile in the whole process-amazing! Big thanks again to ‘rvhamcontrolviation’ for setting me off along the right path! Hope this helps someone else.

[edit ] Network Option D — Use NFS

(to do: update / expand the NFS tutorial)

[edit ] USB Guide for v24 and v24SP1 Mega of DD-WRT

Короткий опис статті: how to enable built in camera on laptop USB storage,USB storage,ASUS WL-500g Premium,Asus RT-N16,Asus WL-500W,Asus WL-520GU,Buffalo WZR-HP-G300NH,D-Link DIR-330,D-Link DIR-632,HDsamba2,How to — Format and Partition External Storage Device

Джерело: USB storage — DD-WRT Wiki

Також ви можете прочитати