Share your knowledge at the LQ Wiki.
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org Calculating file sizes from indoors and blocks
 Linux - Newbie This Linux forum is for members that are new to Linux. Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

04-13-2015, 11:30 AM   #1
ubuntuLearner
LQ Newbie

Registered: Apr 2015
Posts: 1

Rep:
Calculating file sizes from indoors and blocks

Hello I have this problem, but I just ant to know if I am on right track:

Quote:
 i_addr is an array of 15 pointers which hold the addresses of a direct data blocks and single indirect, double indirect or triple indirect block. The first 12 elements of the array refer to addresses of blocks on the disk, which actually contain the files data. When a file requires more than 12 direct blocks, the file system must use disk blocks to hold the addresses of the remaining data blocks needed. These are called indirect blocks. In this particular file system the inode holds the addresses of three indirect data blocks in addition to the 12 direct data blocks discussed. There are single, double and triple indirect data blocks. There is one of each. (in total there are 15 references in the inode). A single indirect block (referenced by element 12 of the inode array) holds the addresses of 2048 disk blocks. If the file consumes more blocks then can be referenced by a single indirect block then the file system uses a double indirect block. (referenced by element 13 of the inode array). A double indirect block can hold the addresses of 2048 indirect blocks. If the file consumes more blocks then can be reference by direct, single and double indirect data blocks then the last element of the inode array is used to hold a triple indirect block which effectively references a number of double and single indirect block (ultimately the data).
The Questions I attempted

Quote:
 Given the block size of the file system is 8192 bytes answer the following questions: 1. Whatisthemaximumpossiblefilesizethatcanberepresentedviadirectdatablocks? 2. What is the file size if each element of an indirect data blocks references a data block and all direct blocks are used? 3. Whatistherangeoffilesizesthatwouldrequiretheuseofadoubleindirectblock? 4. Whatisthemaximumfilesizeinthisfilesystem? 5. How much overhead is incurred by the file system to store a file of 8437760 bytes. Overhead is size in bytes of the number of blocks needed to reference this object i.e. indirect blocks etc.

Quote:
 Answer 1) we know 1 block=8192 bytes, and there are 12 direct data blocks so the max. size is (12*8192) bytes = 98304 bytes. Answer 2) file size will be = file size in direct data blocks + (2048*8192) = approximately 17 MB Answer 3) The starting range is > 17 MB. The maximum range will be (2048*8192) + (2048*8192) = Answer 4) Max size of file in this file system is = 98304+(2048*8192)+(2048*8192)*2+(2048*8192)*3=84.33 MB Answer 5) We know first 12 blocks have 98304 bytes. The single indirect block has 2048*8192 bytes. Given 8437760 bytes of file size we have an overhead of (2048*8192)/(8437760-98304)= 2 bytes
Please correct me and why am I wrong.

Thanks

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post kewlapps Programming 2 03-22-2013 03:33 PM sluge Linux - Newbie 1 10-26-2012 10:15 AM krishdeeps Linux - Newbie 1 04-23-2010 04:38 PM sheraz Linux - Newbie 7 10-06-2009 03:05 AM CoonerTheRed Linux - Software 1 02-21-2006 04:13 PM

LinuxQuestions.org

All times are GMT -5. The time now is 08:02 PM.

 Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap -