# Samba and 2Gig file size limit

## cmay4

I have Gentoo running a samba server (ext3), and mounting a WinXP NTFS partition with the following line in /etc/fstab:

```
//winxp/backup     /backup smbfs defaults,credentials=/home/may/.smbpasswd,uid=may,gid=users      0 0
```

I use this setup to run nightly backups to the NTFS drive.  Once the backup files got bigger than 2GIG, the jobs would fail.  I've had files > 2GIG on both the gentoo and winxp boxes, so I know the filesystems will support it.  I figure it must be Samba.  I am running the newest version of samba in portage, which I though had no file size limitations.

Does anyone know how to get around this problem?

Chuck

----------

## krt

 *cmay4 wrote:*   

> I have Gentoo running a samba server (ext3), and mounting a WinXP NTFS partition with the following line in /etc/fstab:
> 
> ```
> //winxp/backup     /backup smbfs defaults,credentials=/home/may/.smbpasswd,uid=may,gid=users      0 0
> ```
> ...

 

I've had this problem before ( never did find the answer ), but I can confirm your logic that it is samba causing the error.

----------

## cmay4

Maybe this is just a Samba limitation, although I'm suprised that it would have existed for this long.  I have run across many references to this problem, but no answers.  I'll keep searching...

----------

## col

I had this problem as well but I could not find a solution

----------

## zhenlin

User mode programs get 2G in linux, unless I'm mistaken. If using gentoo-sources, you can raise this to 3.5, but if it is a built-in limitation, too bad.

----------

## xuttuh

I have seen this limitation with Windows shares.  I was creating a image of my gentoo box with ghost.  I thought it was just a limitation with ghost since it runs from dos.

----------

## steveb

 *cmay4 wrote:*   

> I have Gentoo running a samba server (ext3), and mounting a WinXP NTFS partition with the following line in /etc/fstab:
> 
> ```
> //winxp/backup     /backup smbfs defaults,credentials=/home/may/.smbpasswd,uid=may,gid=users      0 0
> ```
> ...

 

i think it is your backup application wich has the limit and not samba. if you are using tar, then it could be tar wich does not allow you to have a >2GB file.

if you want to try if samba has a 2gb limit, try:

```
dd if=/dev/nul of=/backup/bigfile bs=1024k count=2560
```

i would be surpriced, if samba would not produce this ~2.5gb file! but maybe the ntfs filesystem implementation in linux has a 2gb limit?!?

cheers

SteveB

----------

## cmay4

The dd command didn't work for me (just created a zero byte file on local or samba shares), so I used "cat" to create a large file.  It still didn't work:

```
$ ll bigfile

-rw-r--r--    1 may      users    2524065396 Jan 20 14:26 bigfile

$ cp bigfile /backup

File size limit exceeded

```

Does anyone have any ideas?  Really seems like a Samba limitation to me.

Chuck

----------

## col

 *zhenlin wrote:*   

> User mode programs get 2G in linux, unless I'm mistaken. If using gentoo-sources, you can raise this to 3.5, but if it is a built-in limitation, too bad.

 

where in the kernel can you change this ?

----------

## steveb

 *cmay4 wrote:*   

> The dd command didn't work for me (just created a zero byte file on local or samba shares), so I used "cat" to create a large file.  It still didn't work:
> 
> ```
> $ ll bigfile
> 
> ...

 

sorry!!! i was this morning not 100% awake  :Smile: 

```
dd if=/dev/random of=/backup/bigfile bs=1024k conv=sync count=2560
```

cheers

SteveB

----------

## chardros

I am dealing with this very issue now.  I've found a few patches and so forth, and was going to hack up the samba ebuild or something to get LFS support going, but I wanted to see if anyone else had solved it...  

The patches I found for smbfs and smbmount are here:

http://www.hojdpunkten.ac.se/054/samba/

Thoughts?  Thanks in advance.

----------

## cmay4

 *steveb wrote:*   

> sorry!!! i was this morning not 100% awake  
> 
> ```
> dd if=/dev/random of=/backup/bigfile bs=1024k conv=sync count=2560
> ```
> ...

 

```
$ dd if=/dev/random of=/backup/bigfile bs=1024k conv=sync count=2560

File size limit exceeded
```

No difference.  Definitely the smbfs.

 *chardros wrote:*   

> I am dealing with this very issue now.  I've found a few patches and so forth, and was going to hack up the samba ebuild or something to get LFS support going, but I wanted to see if anyone else had solved it...  
> 
> The patches I found for smbfs and smbmount are here:
> 
> http://www.hojdpunkten.ac.se/054/samba/
> ...

 

No thoughts, but I'd love to hear your results.  Didn't see any 2.4.19 patches, just 2.4.18.

Chuck

----------

## cmay4

Does anyone know if NFS has the same limitation?

----------

## Rhiz()m3

add these cflags to your samba makefile: -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64? 

this will enable large file support for samba.

http://www.lrz-muenchen.de/services/compute/linux-cluster/develop/LF.html

----------

## cmay4

 *Rhiz()m3 wrote:*   

> add these cflags to your samba makefile: -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64? 
> 
> this will enable large file support for samba.
> 
> http://www.lrz-muenchen.de/services/compute/linux-cluster/develop/LF.html

 

Thanks for the tip.  If I am using the ebuild of Samba, can I just set my CFLAGS environment variable before doing an emerge -u samba?  If not, does anyone know how to enable these flags in the ebuild?  Thanks.

----------

