Samba mount and access large 2GB+ files from share or NAS device

Q. I’m using NAS server share to make a backup of my webserver. However samba is not allowing me to backup of large files (2GB+).

ADVERTISEMENTS

My Samba share mount command is as follows:
smbmount //nas1.domain.com/sharename /datanas -o username=LOGINNAME,password=LOGINPASSWORD

Now if I copy file called /var/log/httpd/access.log (which is 3.5 GB file):
cp /var/log/httpd/access.log /datanas

I get ab error – file size limit exceeded

How do I solve this problem and copy large files to NAS samba share?

A. Linux kernel use smbfs.ko/smbfs.o module and it does not support file sizes greater than 2 GB. This is well known problem.

Mount your NAS samba share with lfs (large file system) option. General syntax is as follows:
smbmount //Hostname/Username /local/mountpoint -o username=username,password=password,lfs

For example:
# smbmount //nas1.domain.com/sharename /datanas -o username=LOGINNAME,password=LOGINPASSWORD,lfs

Where,

  • //nas1.domain.com/sharename : Server and Share name
  • /datanas : Local mount point
  • -o username=LOGINNAME,password=LOGINPASSWORD,lfs : Specify login, password and lfs options

Now you should be able to copy large files w/o a problem.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
6 comments… add one
  • gary Jun 9, 2007 @ 10:39

    Thank you for adding this information. It proved very helpful.

  • Leonard Lilla Sep 10, 2007 @ 1:40

    Hey,

    Well, I had been looking for this a long time. I don’t know why I never landed on this site before. But I am here and thank you for this post. Saves me a lot of trouble!

    Leo

  • John Jan 27, 2008 @ 22:42

    Did you format the drive using the NTFS format? it sounds to me the drive is formatted as FAT32, which does not allow for files larger than 2GB

  • DanD Mar 3, 2008 @ 15:22

    FAT32 allows files larger than 2GB, up to almost 4GB

    “You cannot create a file larger than (2^32)-1 bytes (this is one byte less than 4 GB) on a FAT32 partition.”

    http://support.microsoft.com/kb/314463/

    also http://en.wikipedia.org/wiki/Fat32#FAT32

  • nisarg Mar 4, 2008 @ 18:49

    Hi, thanks!
    Thats been very useful.
    I was stuck at 2GB trying to rescue 60gb disk, writing to an NFTS partition mounted via SMBMOUNT.
    Just one question. With this lfs option – is there any limits at all? i hope not

  • peter Apr 2, 2016 @ 23:12

    hi,
    cool hint, the smbmount, lfs did it for me, but only on one of several machines. the others return that the smbmount command would not be found. what is missing here or what do i have to do or add for package?
    regards
    peter

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.