Maximum file size given a particular inode structure?

前端 未结 3 654
星月不相逢
星月不相逢 2021-01-08 00:11

Suppose a UNIX file system has some constraints--say, 2 KB blocks and 8B disk addresses. What is the maximum file size if inodes contain 13 direct entries, and one single, d

3条回答
  •  星月不相逢
    2021-01-08 01:10

    This explains it for you:

    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."
    

    Swap 8KB for your 2KB, and adjust the entries for the smaller block size.

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

    It's not clear to me from your question if the 13 entries include the singles, doubles and triples, or if they are separate, but that should be easy to adjust -- just change the 10 in the expression to a 13.

    I think I've adjusted all the math correctly... double check it =| Hope this isn't homework I did for you ;)

提交回复
热议问题