如果文件的大小超过了文件系统的最大大小,会发生什么?
If the size of the file exceeds the maximum size of the file system, what happens?
例如,在FAT32分区中,最大文件大小为4GB。但是我能够用 vim 创建一个 5GB 的文件,我保存了文件并再次打开它,控制台输出像楼梯一样断掉了。我有三个问题。
如果文件的大小超过了文件系统的最大大小,会发生什么?
就我而言,为什么要中断?
在 Unix 系统调用中,stat() 可以成功达到 2GB(2^31 - 1)。这与文件系统有什么关系吗? stat() 中数据的限制与文件系统中每个功能的限制之间是否存在关系?
If the size of the file exceeds the maximum size of the file system, what happens?
根据定义,这永远不会发生。真正发生的是某些系统调用(可能 write(2) ...)失败了,执行该操作的代码应该处理这种情况。
请注意 FAT32 filesystems restrict the maximal size of files to 2Gigabytes. Use a better file system on your USB key if you want more (or split(1) 在将大文件复制到您的 FAT32 格式的 USB 密钥之前,它们会分成较小的块)。
如果使用 <stdio.h>
,请注意 fflush(3)、fprintf(3)、fclose (3)(和大多数其他标准函数)可能会失败(例如,因为它们会做一些失败 write(2))。
the console output was broken like a staircase
可能是因为你的 pseudoterminal was in some broken state. See stty(1), reset(1), termios(3) and read the tty demystified.
In Unix system call, stat() can succeed up to a 2GB(2^31 - 1)
你误会了stat(2)。再次阅读其文档
阅读Advanced Linux Programming then syscalls(2)。
I was able to create a 5GB file with vim
要了解 vim read first its documentation then study its source code (it is free software 的行为,您可以而且也许应该研究它的代码)。
您还可以使用 strace(1) 了解某些命令或进程执行的系统调用。
例如,在FAT32分区中,最大文件大小为4GB。但是我能够用 vim 创建一个 5GB 的文件,我保存了文件并再次打开它,控制台输出像楼梯一样断掉了。我有三个问题。
如果文件的大小超过了文件系统的最大大小,会发生什么?
就我而言,为什么要中断?
在 Unix 系统调用中,stat() 可以成功达到 2GB(2^31 - 1)。这与文件系统有什么关系吗? stat() 中数据的限制与文件系统中每个功能的限制之间是否存在关系?
If the size of the file exceeds the maximum size of the file system, what happens?
根据定义,这永远不会发生。真正发生的是某些系统调用(可能 write(2) ...)失败了,执行该操作的代码应该处理这种情况。
请注意 FAT32 filesystems restrict the maximal size of files to 2Gigabytes. Use a better file system on your USB key if you want more (or split(1) 在将大文件复制到您的 FAT32 格式的 USB 密钥之前,它们会分成较小的块)。
如果使用 <stdio.h>
,请注意 fflush(3)、fprintf(3)、fclose (3)(和大多数其他标准函数)可能会失败(例如,因为它们会做一些失败 write(2))。
the console output was broken like a staircase
可能是因为你的 pseudoterminal was in some broken state. See stty(1), reset(1), termios(3) and read the tty demystified.
In Unix system call, stat() can succeed up to a 2GB(2^31 - 1)
你误会了stat(2)。再次阅读其文档
阅读Advanced Linux Programming then syscalls(2)。
I was able to create a 5GB file with
vim
要了解 vim read first its documentation then study its source code (it is free software 的行为,您可以而且也许应该研究它的代码)。
您还可以使用 strace(1) 了解某些命令或进程执行的系统调用。