Mounting Windows shared folder to Linux server

I am keeping this post under Oracle because most of the Oracle database is installed on Linux environments.

Mounting the drive makes a huge difference, for example I was having work like generating few data feeds that was supposed to be kept on one of the shared folder on another remote location.

Initially I when I run my procedure it was generating a PIPE delimited file on my server where Oracle was installed i.e. Linux Server.  Now if I want to move that file to a Windows server then I was mapping the drive to my local windows machine and then copying the file from Linux server and again I was uploading into the mapped drive i.e. Windows Shared Folder.

This entire process was taking almost 4 – 5 hours as the size of the file was really too much like more than 100 to 400 MB.

So then by going with Experts-Exchange.com I came to know that there is a process where we can mount the shared drive to any Linux environment. I got a link (http://www.amitnepal.com/mounting-windows-share-to-linux/) from there which really helped me to achieve my work done by less than 10 minutes from 4-5 hours.

For creating the mount point we need to have few information from the Windows Server like as below: 

Windows Server Name: ABC.xyz.com
IP Address: 183. **.**.**
Windows Path: D:\WindowsSharedFolder\Myfiles\
User credentials: SLOBA/***** (Read/ Write permissions on the folder)

Once we have all the details we can connect to the Linux Server and log in as Root user and follow the below process:

1. Create the directory to mount the windows share

mkdir -p /app/sloba/winshare

2. Need to get the windows system name, share directory, username and its password to mount

Windows Server Name: ABC.xyz.com
IP Address: 183. **.**.**
Windows Path: D:\WindowsSharedFolder\Myfiles\
User: SLOBA
Password=******

3. We need an additional package to mount cifs file system:

samba-client-3.0.33-3.37.el5.x86_64

4. For installing the samba package we can use :

$yum install samba-client

5. Now give the below command to mount

$mount -t cifs -o user=sloba,password=***** // ABC.xyz.com/ Myfiles /app/sloba/winshare

6. To verify on Linux system enter the below command:

$ df -h

7. To auto mount whenever server reboots, need to add entry in /etc/fstab

Add below entry in fstab:

// ABC.xyz.com/ Myfiles /app/sloba/winshare cifs user=sloba,password=**** 1 3

8. First check unmount and then remount the drive again

umount /app/sloba/winshare

Below command is used to mount the drive again:

mount -a
df -h

Now if you create a directory on the same path i.e. /app/sloba/winshare and try to export any file from Oracle system then it file will be generated on the Windows shared folder i.e. “D:\WindowsSharedFolder\Myfiles”.

For using the export function you can check my earlier blog:

https://slobaexpert.wordpress.com/2012/08/21/exporting-tab-delimited-or-csv-from-oracle/

 

Advertisements

One thought on “Mounting Windows shared folder to Linux server

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s