Operating System - HP-UX
1837835 Members
2215 Online
110121 Solutions
New Discussion

fopen failed to open large file > 2GB

 
teehl
New Member

fopen failed to open large file > 2GB

Recently just migrated some program from HP Tru64 to HPUX 11.23. And C-program in HP Tru64 is running fine which using the fopen to open files > 2GB. However, when comes to HPUX, the same program failed to do so. I have tested using vi to open the large files, it failed as well. Any kernel/solutions?
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: fopen failed to open large file > 2GB

Shalom,

largefiles is not enabled on the filesystem.

fsadm can be used to convert it.

newfs can destroy the filesystem and rebuild it properly.

A backup prior to either approach is recommended.

No entries are required in /etc/fstab to support this.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jaime Bolanos Rojas.
Honored Contributor

Re: fopen failed to open large file > 2GB

Teehl,

Also this thread will give you some examples on how to support large files,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1021614

Please notice for those examples, you need to have online jfs.

Regards,

Jaime.
Work hard when the need comes out.
teehl
New Member

Re: fopen failed to open large file > 2GB

There is nothing wrong with filesystem, the files is actually 5GB in size. It's just the matter of I can't vi the file or using the C function fopen to read the file.
A. Clay Stephenson
Acclaimed Contributor

Re: fopen failed to open large file > 2GB

Do a man fopen64.
If it ain't broke, I can fix that.
Steven E. Protter
Exalted Contributor

Re: fopen failed to open large file > 2GB

Shalom,

Thanks for the additional information:

vi is a bad tool for openning files even up to 2 GB. It probably can't open 2 GB or large files. Even if it could, I wold warn against using it.

I think A. Clay is indicating you may wish to use a different C function to open the file, one that can open a file greater than 2 GB requires a 64 bit address space.

Complete information will lead to better answers. I recommend you take your time and write longer, more detailed ITRC questions in the future.

Good Luck,

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com