Late this past week I decided to use one of my servers as a file server, mainly a place for me to put important files that I use on multiple machines so I wouldn’t have to keep transferring them every time I needed to use it. I opted to use Samba for this purpose.
Getting samba set up on my servers (CentOS, a RHEL clone) was simple. Getting my ubuntu machine to mount it automatically was equally as simple. In all, after researching the best way to go about it (I had not set up a samba server before) it took maybe ten minutes to have everything up and running. It all seemed to work just fine, I could create folders, move files , create files, etc. It all worked. That is, until I tried to move a file larger than 2gb. In particular I was moving some movie files I have that are in some cases larger than 2GB.
I was tired when I discovered this problem, and didn’t bother to figure it out at the time. Today I finally got around to investigating the issue and found that it’s because by default smbfs doesn’t support large files, at least not in Ubuntu. Samba DOES support large files as long as the underlying file system supports it (Fat32 does not, NTFS does). There IS an answer, however, and the solution ended up being to add 4 characters to the line in /etc/fstab to support large files. The option that needs to be passed when mounting is “lfs” (which means large filesystem support, but some take to mean large file support).Â Adding that as an option to the line in my fstab for my samba share solved the issue.
my /etc/fstab line now looks something like this:
//10.0.1.12/monkeyboy /home/john/Monkeyboy smbfs auto,credentials=/root/.credentials,uid=john,umask=000,lfs 0 0
To explain for some who might not know, Â the credentials=/root/.credentials tells the mount command that it can find the login info (username and password) in that file, which happens to only be readable by root. Â Otherwise the username and password would be visible in the clear in the process list.
It took me a while to find out what was needed to get this up and running. I had also seen reports that changing smbfs to cifs would do the same, but that solution did not work for me – though to be fair I didn’t take the time to troubleshoot it, instead opting to try the lfs flag for smbfs. That worked perfectly for me, so I didn’t bother trying out CIFS any further.
[tags] Samba, LFS, Large Filesystem Support, Ubuntu Gutsy, Ubuntu, Gutsy [/tags]