When you build IceBreak appications you will somtime find your self i a position where you need to pull pictures, PDF's documents etc. from a Linux or windows server. Or maybe just want to use a NAS drive to store savefiles on a less expensive media that the IFS. In these cases you can use the NFS (Network File System). Your IBMi will be the client and have a permanent connection to a NFS server.
Most modern NAS has a NFS server build in. NFS is in most Linux distributions. You can use another IBMi as a NFS server and Windows has an option for installing NFS from the management console. You can even find open-source NFS server and freeware options.
So let’s start with the server: In this article I will use at neat little Windows freeware called freeNFS, which you can download from
http://sourceforge.net/projects/freenfs/
I use this little server because is has what is needed to make the connection, and the simplicity in the setup:
You can start the freeNFS.exe right after you have done the download – no explicit installation are required. It will show as a little icon in you windows sys-tray.
Now right click to configure- click on “settings”:
Fill in the folder you want to share i.e. create C:\nfstest on you disk and fill this name into the “path” field
Next: fill in the TCP/IP address of you IBMi in the “client” tab. And you are done !!. Your server is ready.
Now - what you need to do on the IBMi is two simple CL commands to configure the NFS client:
1:
You need a folder you can “mount” your file system on. Simply make a root folder in the IFS:
MKDIR DIR('/nfstest')
The directory nfstest here will not actually keep the remote system files, but rather be used as at virtual name.
2: Next you need to mount the remote file share. You “mount” the NFS files system on top of the directory you just have created. This is you “mount-over-directory”.
MOUNT TYPE(*NFS) MFS('192.168.5.78:/') MNTOVRDIR('/nfstest')
Notice the MFS is the IP address of you NFS server. After the colon you can give the share name. Here I am using the root of the share. Given by the forward slash.
That’s if from an IBMi perspective. Lets give it a try:
WRKLNK ‘/nfstest’
Will produce a directory list of all files and directories in C:\nfstest on my windows computer.
You can now use CPY and even use SAV and RST from image catalogs placed on your NFS server.
Security: There is none! Alt least not if you compare NFS with normal file shares. The NFS protocol is designed to be a server-to-server connection between peers. So think about is as you plug a USB drive into you computer. Normally you don’t need security for your when you “mount” a USB drives.
The performance is much better than QNTC, which used an ancient SMB / Windows implementation.
Note: When you have a NFS mounted then a full backup of the IFS will try to backup all resources on the NFS drive. That can be both good or bad. In any cases you need to have a look at your backup procedures and maybe you need a *OMIT on SAV command for the NFS mount-over-directory.