Tuesday 15 September 2009

Mounting a NAS drive share

I have a Maxtor NAS drive on my home network which is a convenient place to store my photos and music. After moving onto Ubuntu one of the first things I wanted to do was get this connected.

Before starting this, make sure winbind is installed and working. See my earlier ping by name post.

As an initial test I tried using the file manager, just to make sure that there weren't any other problems lurking.
Accessing my NAS drive using the file manager in gnome is convenient, but not very easy for applications to access the files, and I'd have to remember each time I logged in. I wanted to mount the NAS as part of the filesystem. I found this article on google:
http://justlinux.com/nhf/Filesystems/Mounting_smbfs_Shares_Permanently.html

Creating a mount point by hand
first of all, I create a directory in the /mnt folder to act as the mount point. You could create this anywhere, including in your home folder, but I found that actions like searching in my home area would take ages as it would also try to search the network drive. Same goes for archiving my documents - so I went for the more standard /mnt option instead
> cd /mnt
> sudo mkdir maxtor01-phil

then use smbmount to mount the share on the folder
> smbmount //maxtor01/Phil /mnt/maxtor01-phil -o username=myusername,password=mypassword

things to note:
myusername and mypassword are the username and password for the NAS share, not your ubuntu login
the comma between the parameters must have no spaces around it
If you havent set up winbind, it probably wont resolve the sharename but you could test by substituting the IP address of the drive. See my earlier
ping by name post on how to fix this.

Making the mount permanent
create a file in the home directory called .smbpasswd - this will hold the logon credentials in a secure way
> cd
> echo username=myusername > .smbpasswd
> echo password=mypassword >> .smbpasswd
> chmod 600 .smbpasswd

chmod 600 means only root will have access

next add the mount lines to /etc/fstab (obviously change the share names)
# maxtor01 NAS drive
//maxtor01/Phil /mnt/maxtor01-phil smbfs credentials=/root/.smbpasswd,uid=phil 0 0

now every time I connect to my home network, the remote shares are automatically mounted.

1 comment:

  1. order tramadol online without prescription Buy tramadol online directed by doctors, this medicine is used for moderate to severe pain.

    silver singles silver singles login uses an algorithm that matches you with people based on your personality, location, age, and desired relationship outcomes.

    ReplyDelete