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.
Articles Related
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
Create a symbolic link
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
- Add this line in the file /etc/fstab
# 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