Using NAS Storage from a Linux Computer
You may need to read or write data to/from a NAS (Network Attached Storage) from a Linux computer.
You can use the native graphical file manager(s) to acheive this, just as you would on Windows or Mac OS, but here we show how this is acheived from the terminal command line.
First we need to create a folder that will be used as a mount point. This folder can be located within the home folder or more typically in the /mnt folder. In this example we create a folder nas that will be used as our mount point.
sudo mkdir /mnt/nas
Next we need to mount the remote folder on the NAS to the mount point. In this example we will use a QNAP NAS on our local network with a hostname of ts262 and and IP address of 192.168.1.17
We will also need to know the username and password of the QNAP user e.g. bigusername , password n0Tvery5ecur3
The QNAP NAS has a number or shared folders. We want to access the Public folder.
Substiture your own hostname/ip address, folder name, username and password in our example commands
To mount this folder we use the following command (using the hostname)
sudo mount -t cifs -ousername=bigusername,password=n0Tvery5ecur3 //ts262/Public /mnt/nas
or using the IP address of the NAS
sudo mount -t cifs -ousername=bigusername,password=n0Tvery5ecur3 //192.168.1.17/Public /mnt/nas
You may need to supply additional parameters to match the version of the file system and default usernames. For TrueNAS shares we use the following command to mount a remote folder:
mount -t cifs -o username=bigusername,password=n0Tvery5ecur3,vers=3.0,uid=1000,iocharset=utf8 //192.168.1.19/sharedfolder /mnt/nas
Once you have successfully mounted the remote drive you can copy data to/from the NAS using standard Linux commands e.g copy all music from the local machine to the NAS drive:
cp -rv ~/music /mnt/nas