Mounting Particular NAS directory to Linux File System
Now a days, most of the NAS storage devices come with a support to access the storage in multiple ways/protocols for different operating systems. In windows you can map drive option or you can better use ftp and sftp clients like FileZilla. In case of Unix/Linux distros. You can use command line based utility with easy syntax called “mount.cifs” to access remote storage devices. Following example illustrates the usage of above command.
NAS devices facilitate user based restricted acesses to directories. Such directories can be remotely accessed i.e. Read/Write and mounted in a linux filesystem to manage natively.
Let’s mount such directory as below:
1.Create Folder in /mnt to mount remote location in it.Usually mnt directory is preferred to maintain uniformity in mount locations.
2.Mount/Connect/Link command :
mount.cifs -o username=typeyournasusername //IPorHostname/shared_data/ /mnt/shared_data
The above command will mount/link NAS directory named “shared_data” with username having authority to access to local directory
“/mnt/shared_data”.You can list the contents using ls command.Here response time would depend upon network bandwidth between local and NAS.
1.Do not use rm command inside mounted directory,as it will delete the same file from NAS as well.
2.Avoid mounting bigger/parent directories directly, rather use specific directory. As it would be safer in case of disasterous condition like accidental removal/renaming/processing etc..
3.Unmount/Unlink/Safe To Remove/Disconnect :
If it doesnt work due to message like “device is busy ,unable to unmount” please verify and ensure that all files are closed.Retry again , if it still doesnt work use lazy loading option as:
umount -l /mnt/shared_data
Sometimes it takes couple of minutes depending upon mounted directory size, network and local system resource usage.