Linux - Samba - How to mount/map a Windows Share on Linux

About

Often you use a central Windows repository to save your installation file. In order to make them available to Linux, you can mount a Windows Share instead of to copy them.

If you want to “map a drive” from a Linux computer to a shared folder on a Windows computer or a shared folder on a Linux computer, you use samba.

Steps

Verify that you see the shares

 
[root@di-obia-01 mnt]# smbclient -L rixni02 -U gerardnico
Password:
Domain=[RIXNI02] OS=[Windows 7 Home Premium 7601 Service Pack 1] Server=[Windows 7 Home Premium 6.1]

        Sharename       Type      Comment
        ---------       ----      -------
        ADMIN$          Disk      Remote Admin
        C$              Disk      Default share
        E$              Disk      Default share
        F$              Disk      Default share
        IPC$            IPC       Remote IPC
        kiosque         Disk
        Users           Disk
        video           Disk
Domain=[RIXNI02] OS=[Windows 7 Home Premium 7601 Service Pack 1] Server=[Windows 7 Home Premium 6.1]

Mounting the Windows Shared Folder

Run the following command to mount the shared folder to a local path:

mount –t cifs –o username=myUsername,password=MyPassword //WindowsHost/WindowsSharedFolder /myMountFolder/MyMountPoint

Example:

mkdir /mnt/kiosque
mount -t cifs -o username=gerardnico,password=MyPassword //rixni02/kiosque /mnt/kiosque

Optional: Create a symbolic link to the mounted drive:

ln -s /myMountFolder/MyMountPoint /PathOfSymlink

Mounting Automatically

  • Create a credential file /root/smbpass.txt
username=MyUsername
password=MyPassword

chmod 600 /root/smbpass.txt
# mounting cifs
//HostName/MyShare  /mnt/MyMountPoint  cifs    credentials=/root/smbpass.txt 0   0

  • Test it (You must get no error)
mount //HostName/MyShare
  • Show it:
[oracle@di-obia-01 ~]$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      80370408  16157412  60064568  22% /
/dev/sda1               101086     12583     83284  14% /boot
tmpfs                  2172152   1030132   1142020  48% /dev/shm
//rixni02/kiosque    976759804 172971968 803787836  18% /mnt/kiosque

Support

mount: unknown filesystem type 'smbfs'

use cifs instead

tar: Cannot open: Cannot allocate memory

You may get this error when your untar a file through cifs.

tar: ./i9Pi/jre/README: Cannot open: Cannot allocate memory
tar: ./i9Pi/i9Pi.bin: Cannot open: Cannot allocate memory

Solution, on the Windows plateform:

  • Set the following registry key to ’1′:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache

  • Set the following registry key to ’3′:
HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size

  • Restart the “Server” Service

Credits: Windows 7 Nonpaged Pool Srv Error 2017





Discover More
Samba Rpm Files
Linux - How to transfer/copy files via a network connection using Samba between Linux and Windows

Samba allows Linux computers to share files and printers across a network connection. By using its SMB protocol, your Linux box can appear in Windows Network Neighbourhood or My Network Places just like...
Oracle Database Installationl Location 11gr2 Oel Linux X86 64
Oracle Database 11gR2 - Installation on Linux OEL 5 Update 5 (x86_64)

Installation of Oracle Database 11g Release 2 (11.2) x86_64 on Oracle Enterprise Linux 5 Update 5 on the file system (ie without ASM) or GRID. Linux OEL installation login as root ...



Share this page:
Follow us:
Task Runner