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, double, and triple indirect entry each?
Asked
Active
Viewed 4.3k times
3 Answers
23
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 ;)

WhirlWind
- 13,974
- 3
- 42
- 42
-
2Sorry to bother you with a question 7 years later on this, but what do the two variables mean inside the equation? `2**10` or `2**20` - why 2 and why 10 or 20 for each? – NateH06 Apr 01 '17 at 19:49
-
1@NateH06 `2**10` means `2^10`, and I think those numbers are as follows: 10 is for 10 direct entries, `2^10 = 1024`, which is 1024^1. `2^20 = 1024^2 and 2^30 = 1024 ^ 3` each index block contains 1024 pointers, so it makes sense. Result is `1,000,000,000 KB = 8.59833 TB` – MuhsinFatih Nov 28 '18 at 16:49
1
How many pointers in 1 block?
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"
How many pointers in the file system?
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"
Therefore the size of the file system is:
size of the disk is : total of pointer*size of the pointer , which is around 34 GB "

user3035698
- 113
- 1
- 1
- 4
-
4I dun think this is correct for the first 13 entries, there should only be 13 pointers? – Timothy Leung Apr 14 '15 at 13:29
0
We hv a shortcut that can be used for competitive exams, given as :
Max file size possible = [ block size/pointer size]^3 * block size

V-rund Puro-hit
- 5,518
- 9
- 31
- 50