Sunday, 21 December 2008

Mounting QNAP from Linux

Accessing the QNAP from Ubuntu is fairly easy.

First install "smbfs": -

sudo apt-get install smbfs

Then it's just a matter of creating the relevant directories in /mnt

sudo mkdir /mnt/Qdownload
sudo mkdir /mnt/public
sudo mkdir /mnt/Qmultimedia
sudo mkdir /mnt/Qweb


...and then editing /etc/fstab

//192.168.0.2/Qdownload /mnt/Qdownload cifs credentials=/root/.credentials,directio,iocharset=utf8,noacl,noperm,nosetuids,rw
//192.168.0.2/Public /mnt/public cifs credentials=/root/.credentials,directio,iocharset=utf8,noacl,noperm,nosetuids,rw
//192.168.0.2/Qmultimedia /mnt/Qmultimedia cifs credentials=/root/.credentials,directio,iocharset=utf8,noacl,noperm,nosetuids,rw
//192.168.0.2/Qweb /mnt/Qweb cifs credentials=/root/.credentials,directio,iocharset=utf8,noacl,noperm,nosetuids,rw


You then need to create a file with your username and password in it: -

sudo vi /root/.credentials

and put the following in it: -

username=user
password=pass


A simple "sudo mount -a" will mount these filesystems ready for use.

4 comments:

Patrice said...

Hello, I have a Qnap TS-101, and I use succesfully your commands.
At shutdown, to avoid "CIFS: server not responding", I have installed the script umountcifs, downloadable at this adress :

http://ubuntuforums.org/showthread.php?t=293513&page=2

Did you manage to get the print server working ?

I have tried something like smb://192.168.0.10/NameoftheNAS

without any success.

Regards, Patrice

finster said...

Hi Patrice,

Glad the commands were useful - the umountcifs command sounds like a great tip.

Sorry - I never tried the print server - I have a networked laser printer with a built-in print server.

CH.GE said...

Thanks

htw said...

Patrice,

Try smb://192.168.0.10/NASPR(X)
or
smb://192.168.0.10/printers/NASPR(X)

X being numerical, try 1, 2 or 3. Note that there is no bracket.

I'm using Qnap TS 219, though I'm quite sure it's quite similar.