How to access an external network drive using Ubuntu

Post image for How to access an external network drive using Ubuntu

by bledsoe on April 5, 2012

The new Netgear N600 router I just bought for my home wireless network works great.  It even has a USB port on the back to which you can attach an external USB hard drive, which every computer on the network can then use as a kind of shared storage space.  And it's really simple to use, too; you just plug in your external hard drive to the router, type a couple of commands into your computer, and presto!

Actually, it turns out the external drive feature is really simple to use as long as you're using either a Windows PC or a Mac, because Netgear was kind enough to provide the commands for you to type in for those two systems.  If, however, you'd like to be able to access your new external network drive using your Ubuntu computer, you have to do a little bit of extra googling to figure out the magic commands to type in.  So once you have your hard drive connected to your router, open up a terminal window on your Ubuntu machine and do the following:

1. Install the smbfs package - smbfs is part of a suite of programs called Samba which handles networking type stuff between Unix and Windows systems.  Install it on your Ubuntu machine by entering "sudo aptitude install smbfs" (without the quotes).

2. Create a directory in which to "mount" your external hard drive - I created a directory called public under my media directory, by entering "sudo mkdir /media/public" (without the quotes).

3. Edit the file /etc/fstab - This is a config file your computer reads each time you start it up, and you need to add some lines in it to tell it how to mount your external drive.  Enter "gksudo gedit /etc/fstab" (without the quotes) and at the end of the file add the following lines:

# Mount my Netgear network drive using these parameters
// /media/public smbfs guest 0 0

The # line is just a comment line.  The second line is the important one (and note that there's a space after "USB_Storage").  It tells your computer that when it starts mounting all the different things that need to be mounted, there's something at // (i.e., your external hard drive) that you want to be able to access by going to the directory /media/public (which you created in step #2 above).  The rest is just some parameters used by the mount command.

Apparently "USB_Storage" is some kind of hard-wired name that Netgear gives to whatever USB drive you plug in to your router; it would have been nice if Netgear had mentioned this somewhere in the documentation, but I guess they didn't think it was necessary.

4. Re-mount your drives - Save your newly updated fstab file, then type "sudo mount -a" (without the quotes) and your computer will mount all your drives again, including your external drive according to the new line you added to your fstab file.

And you should now be able to see your new external drive at /media/public.  Note that there are probably other ways to make this work as well, and if folks more fluent in Ubuntu than I am want to offer additional tips in the comments, please feel free.

Also, many thanks to the authors of these two posts, who provided a lot of the information for this one:

Related posts:

  1. My Ubuntu-Windows dual boot disappeared!
  2. How to fix your unreadable screen after upgrading Ubuntu
  3. Migrating from Windows to Linux
  4. Finally trying out Linux
  5. How Come My Cell Phone Can Access the Internet Anywhere, but My Laptop Has to Be In A Coffee Shop?

Previous post:

Next post: