file size limitation in linux?

Mark J. Dulcey mark at buttery.org
Wed Oct 16 13:50:31 EDT 2002


Greg Gimler wrote:
> I am trying to record a file > 2gb in size.  I'm using the system call 
> open() with the mode switch O_LARGEFILE.  I get  a compiler warning that 
> the macro doesn't exist.  I am including sys/fcntl.h.  I'm running 
> redhat 7.1 with kernel
> 2.4.2-2.  Does anyone know of a way around this 2gb limit?  Thanks.

First, you have to use a file system that supports larger files. ext2 and ext3 have a file size limit of 2GB, so even if you got your code to compile, it wouldn't help. On that version of Red Hat, about the only option you have for bigger files is FAT32, which will handle files up to 4GB. On a newer system, you could use ReiserFS or JFS; I wouldn't recommend trying either of those on a system running a 2.4.2 kernel.

I had a look at fcntl.h on my system (SuSE 8.0, gcc 2.95.2), and it doesn't have O_LARGEFILE either. What it does have is an open64 function that you can use to open large files. There are also some symbols that can be defined to make open64 replace open.

I don't have any personal experience with using this stuff.




More information about the Discuss mailing list