Showing posts with label Network Share. Show all posts
Showing posts with label Network Share. Show all posts

Monday, December 29, 2014

CIFS failed to allocate memory?

If you are mounting your Windows network shares in your Ubuntu, do not hurry to move your files to this newly added mount point. Most probably you will be regret very soon, as the system may give you error Failed to allocate memory and soon after that your files will gone missing. Yes, all gone! That's what happened to me.

The issues seems to cause by Windows rather than Ubuntu itself. There is a good explanation in this link:
https://wiki.archlinux.org/index.php/Samba/Troubleshooting

But I will copy & paste some of the content here, in case the link broken in the future.

======== Copy & Paste from archlinux.org, please contact me if remove is required ========

Windows 7 connectivity problems - mount error(12): cannot allocate memory

A known Windows 7 bug that causes "mount error(12): cannot allocate memory" on an otherwise perfect cifs share on the Linux end can be fixed by setting a few registry keys on the Windows box as follows:
  • HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache (set to 1)
  • HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size (set to 3)
Alternatively, start Command Prompt in Admin Mode and execute the following:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "Size" /t REG_DWORD /d 3 /f
Do one of the following for the settings to take effect:
  • Restart Windows
  • Restart the Server service via services.msc
  • From the Command Prompt run: 'net stop lanmanserver' and 'net start lanmanserver' - The server may automatically restart after stopping it.



Note: Googling will reveal another tweak recommending users to add a key modifying the "IRPStackSize" size. This is incorrect for fixing this issue under Windows 7. Do not attempt it.

Saturday, February 23, 2013

[Ubuntu] Temporarily / Permanently Mount Cifs Network Shares

It is strange that Ubuntu 12.10 doesn't come with cifs-utils installed. Whenever you try to mount a network folder via mount -t cifs -o username=user,password=pass //server-name/shared /mnt/shared, it will give you the following error message:

1:  mount: wrong fs type, bad option, bad superblock on //192.168.0.11/Dropbox,  
2:      missing codepage or helper program, or other error  
3:      (for several filesystems (e.g. nfs, cifs) you might  
4:      need a /sbin/mount.<type> helper program)  
5:      In some cases useful info is found in syslog - try  
6:      dmesg | tail or so  

Execute dmesg | tail will return the following result:

1:  [ 5537.959706] CIFS VFS: Connecting to DFS root not implemented yet  
2:  [ 5537.959815] CIFS VFS: cifs_mount failed w/return code = -22  

To solve this, simply apt-get install cifs-utils. After that run the same command again and you should be able to mount the network shared folder.

To permanently mount the shared folders, go to /etc/fstab, and add the following line:

1:  //server-name/shared     /mnt/shared     cifs     defaults,_netdev,credentials=/home/user/.smbcredentials     0     0  

_netdev parameter is being explained at the last section of this documentation, which in general mean connect only when network is available:
https://help.ubuntu.com/community/MountWindowsSharesPermanently

credentials and /home/user/.smbcredentials is a file created to store the username and password for the remote login, so that we don't put these sensitive info at risk because the /etc/fstab can be viewed by every users on the system. DO NOT forget to set the file permission for the .smbcredentials:

1:  chmod 600 /home/user/.smbcredentials  

Now enjoy working with your network shares!

If you would like to read on, the following articles is good to go:
  1. https://help.ubuntu.com/community/Samba/SambaClientGuide
  2. https://wiki.ubuntu.com/MountWindowsSharesPermanently
  3. https://help.ubuntu.com/community/MountWindowsSharesPermanently




Monday, December 24, 2012

[Fedora] Samba File Sharing Revisit

Update 25/12/12 17:40
Alright, I have much better idea what happen now. The pcmanfm file explorer that come with LXDE does not auto mount network folder, but Dolphin will do the trick.

As for the cifs-utils, that is needed to mount network folder from within the terminal.

So what about samba stuffs? I haven't dig into that, but if you have problem, no harm to install that.

I hope this update will make things clearer.

=======================================

Network file sharing is not easy in Linux. Despite my Xfce works fine with Samba network, but I have no luck on newly installed LXDE.

So what's the problem with it? To be very honest, I did not analyse the problem, initially I work around with mount & umount discussed in previous post. But today I have installed a few stuff from the package manager and it seems to work now directly from within Dolphin.

Below are packages that you may try to install to get it works:

  1. cifs-utils
  2. autofs (I guess this one is to deal with USB stick, cd/dvd, rather than network. But if you haven't install, you may try this.)
  3. samba-common
  4. samba Server and Client software to interoperate with Windows machine
Somehow, I feel it is the cifs-utils which do the trick. I would not dig to the root of this issue, perhaps next time. Until then, I hope this will help.

And one last thing, Merry Christmas and Happy New Year 2013!!


Friday, December 21, 2012

[Fedora] Mounting a network shared folder under LXDE X11 Desktop

Switching from Xfce to LXDE has made me unable to access my network shared folder. The reason is using Nautilus in Xfce will automatically mount the network folder. But in LXDE, the network folder is not mounted by default, and I need to mount it using command line.

The bad thing is as a novice user, command line doesn't work as smooth. Luckily there is a tools namely "Gigolo" to simplify the procedure. It is located under Application Menu > System Tools > Gigolo. In some case it does not come with LXDE installation, then one would need to manually install it, yum install gigolo.x86_64.

Open up Gigolo we can see a connect button, press it and set the following:

  • Service type = Windows Share
  • Server = your server hostname / IP address
  • Share = the shared folder you would like to mount
  • Domain = this can be left blank
  • Username = username to access the server
Once enter / connect is pressed, there could be a pop up dialog (single line field) asking for password. For some reason entering password doesn't get rid of this dialog. Simply close it, then there will be another dialog box pop up, this time with two text field - Domain & Password. Simply ignore the Domain field and key in password. Voila! The network folder is now mounted.