smbfs with large file support on Debian Woody

This page describes how to get large file support (>2GB) for the smbfs filesystem on Debian Woody with a 2.4.20 linux kernel.

Part 1: The Kernel

To be able to use files greater 2GB, your kernel must support it. I found a set of patchesfor kernel 2.4.18, enabling that on Urban's samba/smbfs page (page seems to be offline).

Unfortunatly, they could not be ablied as is on my kernel 2.4.20. So I applied the patches partly manually. For those of you, unable or uninterested in doing so, i generated a diff from my sources, which represents the patches above, adapted to my 2.4.20 kernel sources from ftp.kernel.org:

Thanks to Brad Barnett, I could correct a invalid patch, offered here before.

To apply the patch to your kernel sources, change to the directory containing them and apply the patch by running "gzip -cd smbfs-2.4.20-lfs-unicode.patch.gz | patch -p1".

After that, you have to recompile your kernel or at least its modules (if you have smbfs configured as module. On a Debian system, you can create debs by calling "make-kpkg buildpackage modules". These can later be installed with "dpkg -i *.deb" (IF YOU ALREADY HAVE INSTALLED A 2.4.20 KERNEL AS DEBIAN PACKAGE, YOU HAVE TO REMOVE IT BEFORE!).

After installing the kernel, you have to reboot your system, to make use of its new features. If you only had to install some the modules, you do not have to, of course.

Now, your kernel is ready to support large files on smb shares.

Part 2: smbmount

To make use of the newly created features of your kernel, you have to modify your smbmount program so that it is able to tell the smbfs filesystem to enable large file support.

Thanks to Florian Sukup, I now have corrected my mistake, that Debian Woody users do not need to patch their smbmount program. Also Debian Woody users have to patch their smbmount program! Debian Sarge (aka. "testing") needs no patch for smbmount as it comes with samba-3.0beta, which includes a smbmount program that support the "lfs" option. So here is the description how I did it:

Get the sources for samba by calling "apt-get source smbfs". You will get the following files and directories:

The patch for 2GB support can be found here: smbmount-lfs-unicode.patch.

Build the patched smbfs package like this:

The last command will build the binaries from the package and pack them into the Debian packages. When it is finished, you can find your new smbfs package in the directory above the current one. Install it by typing "dpkg -i --reinstall ../smbfs_2.2.3a-12_i386.deb". That's all.

Now you can mount samba shares with large file support by giving the "lfs" option to smbmount, e.g. like this:

smbmount //server/share /mnt/server -o lfs

The patch, I provide here may also work with other version of the samba package and other distriputions as Debian. One other version reported by Florian Sukup is samba-2.2.7a. The version of samba shiped with Debian/sarge (aka. testing), namely 3.0.0beta2, has native support for large files and does not need to be patched!


Patrick Cernko
Last modified: Tue Oct 14 14:59:19 CEST 2003