给定特定inode结构的最大文件大小?

时间:2010-04-30 03:44:01

标签: unix file system inode

假设UNIX文件系统有一些限制 - 比如2 KB块和8B磁盘地址。如果inode包含13个直接条目,并且每个条目包含一个,两个和三个间接条目,那么最大文件大小是多少?

3 个答案:

答案 0 :(得分:19)

这为您解释:

http://www.cis.temple.edu/~ingargio/cis307/readings/stable.html

"The maximum size of a file will be 8KB*(10 + 2**10 + 2**20 + 2**30), that is more than 8TB."

为您的2KB交换8KB,并调整较小块大小的条目。

2KB*(10 + 2**8 + 2**16 + 2**24)

我的问题不清楚13个条目是否包括单曲,双曲和三元组,或者它们是否分开,但是应该很容易调整 - 只需将表达式中的10更改为13。 / p>

我想我已经正确调整了所有数学...仔细检查它= |希望这不是我为你做的功课;)

答案 1 :(得分:1)

1个街区有多少指针?     

     each block is 2kb = 2^11
     1 disk address is 8b = 2^3
     So, in 1 block there are 2^11/2^3 = 2^8 pointers"
    

文件系统中有多少指针?     

     for 13 direct entries = (2^8)*13 = 3328
     for single  = (2^8)^2 = 2^16
     for double = (2^8)^3 = 2^24
     for triple = (2^8)^4 = 2^32
     total pointer is :3328 + 2^16 + 2^24 + 2^32"
     

因此文件系统的大小是:     

size of the disk is  : total of pointer*size of the pointer , which is around 34 GB "
    

答案 2 :(得分:-1)

我们提供了一个可用于竞争性考试的快捷方式,具体如下:

Max file size possible = [ block size/pointer size]^3 * block size
相关问题