Pages

Saturday, June 27, 2009

Connecting Ubuntu to a Belkin N+ USB drive

After a lot of trouble, I eventually manage to mount a USB drive connected to my Belkin N+ router. This worked no problem on Windows, but failed under linux. From a quick google, it looks like I'm not the only person to have this problem so thought I would write up how to fix it.

Background
This site has a lot of useful information on it about mounting samba CIFS as supported by the Belkin N+: http://opensuse.swerdna.org/susesambacifs.html

The problem

The Belkin is named "BELKIN N+" which includes a space which breaks many of the linux UI/command line tools.

Details you need:
  • YOUR_ROUTER_IP - the IP address you've assigned to your router
  • YOUR_ROUTER_LOCAL_DOMAIN - the domain under LAN > LAN Settings on router
  • YOUR_DRIVE_NAME - the name of your connected drive (in my case FreeAgent)
GUI connection
Install smb4k then you can mount using the relevant details, but you need to manually mount as the spaces prevent the browser working. Add with the following:
  • Share: //BELKIN N+/FreeAgent
  • IP Address: YOUR_ROUTER_IP
  • Workgroup: YOUR_ROUTER_LOCAL_DOMAIN
Ad-hoc Mount
To mount ad-hoc use:
sudo mount -t cifs -o guest,ip=YOUR_ROUTER_IP,domain=YOUR_ROUTER_LOCAL_DOMAIN,_netdev,mand "//BELKIN N+/FreeAgent/" /media/FreeAgent/
  • The quotes are needed due to spaces in the server and if your drive's name has space in it.
  • Remember to create /media/FreeAgent with 777 permissions.
To automount on startup
You need to add this into /etc/fstab (sudo gedit /etc/fstab). As you cannot put quotes around command line instructions you need to replace spaces with "\040" instead:

//BELKIN\040N+/FreeAgent /media/FreeAgent/ cifs guest,ip=YOUR_ROUTER_IP,domain=YOUR_ROUTER_LOCAL_DOMAIN,_netdev,mand
  • _netdev is important as it waits until network is ready before mounting the drive.
  • To unmount cleanly on shut down, you need to run the following
    sudo update-rc.d -f umountnfs.sh remove
    sudo update-rc.d umountnfs.sh stop 15 0 6 .