how inodes work
DESCRIPTION
One of the tutorials I gave at University of Wollongong on inodes. Describes direct, single, double and triple linking, and how that all ties together with addressable space.TRANSCRIPT
![Page 1: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/1.jpg)
inodes explainedTutorial 3 - CSCI212
by: Roman Tarnavski
![Page 2: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/2.jpg)
Data Blocks
A file system contains ‘blocks’ which hold data called inodes. A inode describes a single file in the file system. Typical information described includes, ownership, modification times, size and permissions. We call this information meta-data.
Source: CSCI212 Lecture Notesby: Daniel Saffioti
![Page 3: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/3.jpg)
Data Blocks
Data Blocks
The remainder of the file system (larger proportion) contains data blocks. These store the contents of files.
Source: CSCI212 Lecture Notesby: Daniel Saffioti
![Page 4: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/4.jpg)
Source: CSCI212 Lecture Notesby: Daniel Saffioti
![Page 5: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/5.jpg)
Your typical inode
Direct Blocks
Single
Double
Triple
Mode
Permissions
Size
Timestamps
![Page 6: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/6.jpg)
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Single
Double
Triple
Data Block 1
Data Block 2
Data Block 3
.
.
.
![Page 7: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/7.jpg)
SingleDirect
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Single
Double
Triple
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
![Page 8: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/8.jpg)
Double
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Single
Double
Triple
![Page 9: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/9.jpg)
TripleAddress 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Single
Double
Triple
![Page 10: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/10.jpg)
All Together?
![Page 11: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/11.jpg)
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Direct
Single
Double
Triple
Data Block 1
Data Block 2
Data Block 3
.
.
.
Address 1
Address 2
Address 2048
.
.
.
Data Block 1
Data Block 2
Data Block 2048
![Page 12: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/12.jpg)
Maximum Size of Direct Blocks
![Page 13: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/13.jpg)
Maximum Size of Direct Blocks
Where did the 2048 Addresses come from?
![Page 14: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/14.jpg)
Maximum Size of Direct Blocks
Where did the 2048 Addresses come from?
Assuming 32-bit architectures
![Page 15: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/15.jpg)
Maximum Size of Direct Blocks
Where did the 2048 Addresses come from?
Assuming 32-bit architectures
32-bit = 4 bytes (32 / 8)
![Page 16: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/16.jpg)
Maximum Size of Direct Blocks
Where did the 2048 Addresses come from?
Assuming 32-bit architectures
32-bit = 4 bytes (32 / 8)
Thus 8192 [block size] / 4 [bytes per addressable block]
![Page 17: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/17.jpg)
Maximum Size of Direct Blocks
Where did the 2048 Addresses come from?
Assuming 32-bit architectures
32-bit = 4 bytes (32 / 8)
Thus 8192 [block size] / 4 [bytes per addressable block]
= 2048 Addressable Blocks
![Page 18: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/18.jpg)
Questions
What is the maximum possible file size that can be represented via direct data blocks?
![Page 19: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/19.jpg)
Maximum Size of Direct Blocks
= 8192 x 12 = 98,304 bytes = 96Kb
block sizeblocks
![Page 20: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/20.jpg)
Maximum FileSize using First-Indirect Linking
![Page 21: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/21.jpg)
Maximum FileSize using First-Indirect Linking
Direct: 12 blocks @ 8192 bytes (12 x 8192)
![Page 22: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/22.jpg)
Maximum FileSize using First-Indirect Linking
Direct: 12 blocks @ 8192 bytes (12 x 8192)
=96Kb
![Page 23: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/23.jpg)
Maximum FileSize using First-Indirect Linking
Direct: 12 blocks @ 8192 bytes (12 x 8192)
=96Kb
Indirect: 2048 @ 8192 (2048 x 8192) = 16,384 Kb = 16,480 [Inclusive of Direct] = 16.09Mb
![Page 24: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/24.jpg)
Maximum using Double Indirect
16,875,520 x 2048 addressable blocks
= 34,561,064,960 bytes
= 32,960 Mbytes
![Page 25: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/25.jpg)
Maximum Filesize[direct + single + double + triple]
2048 x 32.1875Gb
= 64.375 Tb
![Page 26: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/26.jpg)
Overhead
![Page 27: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/27.jpg)
Overhead
Wish to store: 8,437,760 bytes
![Page 28: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/28.jpg)
Overhead
Wish to store: 8,437,760 bytes
8437760 / 8192 [bytes per block]
= 1030 blocks x 4 bytes [per address]
BUT
![Page 29: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/29.jpg)
Overhead
Wish to store: 8,437,760 bytes
8437760 / 8192 [bytes per block]
= 1030 blocks x 4 bytes [per address]
BUT
12 Blocks are stored directly
![Page 30: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/30.jpg)
Overhead
Wish to store: 8,437,760 bytes
8437760 / 8192 [bytes per block]
= 1030 blocks x 4 bytes [per address]
BUT
12 Blocks are stored directly
Hence we only have 1018 blocks
![Page 31: How inodes Work](https://reader033.vdocuments.mx/reader033/viewer/2022052411/556d0a94d8b42ad34f8b4bd2/html5/thumbnails/31.jpg)
Overhead
Wish to store: 8,437,760 bytes
8437760 / 8192 [bytes per block]
= 1030 blocks x 4 bytes [per address]
BUT
12 Blocks are stored directly
Hence we only have 1018 blocks
1018 x 4 bytes = 4072 bytes = 3.98Kbytes