Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum file size given a particular inode structure?

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?

like image 336
solvingPuzzles Avatar asked Apr 30 '10 03:04

solvingPuzzles


People also ask

What is the maximum size of the file if an inode contains 13 direct entries and one single double and triple indirect entry each?

inode contains total 13 pointers (52 bytes per inode!) Assuming pointer requires 4 bytes, n = 256 • Max file size: (10 + 256 + 2562 + 2563) * 1024 = 16 GB Same max file size: 16 GB.

What is the maximum file size if I nodes contain 10 direct entries and one single double and triple indirect entry each?

A unix file system has 1-KB blocks and 4-byte disk addresses. What is the maximum file size if i-nodes contain 10 direct entries and one single, double and triple indirect entry each? Explanation: One direct block address(DBA) points 1 kB and we have 10 DBA. So it will take 10 kb.

Is file size stored in inode?

That's where inodes come in. While they don't contain any of the file's actual data, it stores the file's metadata, including all the storage blocks on which the file's data can be found. Information contained in an inode: File size.


2 Answers

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 ;)

like image 174
WhirlWind Avatar answered Oct 12 '22 18:10

WhirlWind


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 "
    
like image 38
user3035698 Avatar answered Oct 12 '22 19:10

user3035698