如何在Linux/Unix中创建大小超过2GB的文件? [英] How to create a file of size more than 2GB in Linux/Unix?
问题描述
我有这份家庭作业,我必须使用bittorrent类算法将一个非常大的文件从一个源传输到多台机器.最初,我将文件切成块,然后将块传输到所有目标.目标具有与其他目标共享它们拥有的块的智能.它工作正常.我想传输4GB的文件,所以我将4个1GB的文件解压缩.当我创建4GB的tar文件时,它并没有出错,但是在另一端,当将所有块组装回原始文件时,它出错了,提示超出了文件大小限制.我该如何解决这个2GB的限制问题?
I have this home work where I have to transfer a very big file from one source to multiple machines using bittorrent kinda of algorithm. Initially I am cutting the files in to chunks and I transfer chunks to all the targets. Targets have the intelligence to share the chunks they have with other targets. It works fine. I wanted to transfer a 4GB file so I tarred four 1GB files. It didn't error out when I created the 4GB tar file but at the other end while assembling all the chunks back to the original file it errors out saying file size limit exceeded. How can I go about solving this 2GB limitation problem?
推荐答案
我可以想到两个可能的原因:
I can think of two possible reasons:
- 您没有在Linux内核中启用大文件支持 li>
- 您的应用程序未使用大文件支持进行编译(您可能需要传递gcc额外的标志,以告知它使用某些文件I/O功能的64位版本,例如
gcc -D_FILE_OFFSET_BITS=64
)
- You don't have Large File Support enabled in your Linux kernel
- Your application isn't compiled with large file support (you might need to pass gcc extra flags to tell it to use 64-bit versions of certain file I/O functions. e.g.
gcc -D_FILE_OFFSET_BITS=64
)
这篇关于如何在Linux/Unix中创建大小超过2GB的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!