File Organization-System Programming-Lecture Notes, Study notes of System Programming

This lecture handout is for System Programming course. It was provided by Prof. Indubhushan Vijayabhas at Ambedkar University, Delhi. It includes: File, Organization, Entry, Description, Offset, Bit, Higher, Writing, Access, Upper, Attributes

Typology: Study notes

2011/2012

Uploaded on 08/07/2012

anishay
anishay 🇮🇳

4.2

(25)

118 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture # 38
Following slide shows how the chain of clusters is maintained in a FAT32 based system.
File Organization
9
11
0
7
R
R
32 bit
0
1
2
3
6
5
4
7
Start Cluster #
FCB
Cont…
EOF
6
8
9
10
11
2^28
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download File Organization-System Programming-Lecture Notes and more Study notes System Programming in PDF only on Docsity!

Lecture # 38

Following slide shows how the chain of clusters is maintained in a FAT32 based system.

File Organization

R

R

32 – bit

Start Cluster

FCB

Cont…

EOF

2^

Fat32 Entry

• Each entry is of 32-bits size but only

lower 28-bits are used.

• Higher 4-bits are not tempered.

• While reading higher 4-bits are

ignored.

• While writing higher 4-bits are not

changed.

FCB in FAT32 system has an enhanced meaning as shown by the slide below.

Now we determine all the parameters in the above slide for a certain volume to translate a

cluster number into LSN.

Sector per FAT copy

  • Offset 14 = 0x0E = Reserved Sect. = 0x Reserved Blocks
  • 0000 EB 58 90 4D 53 57 49 4E X M S W I N
  • 0008 34 2E 31 00 02 20 24 00 4 1 $
  • 0010 02 00 00 00 00 F8
  • 0018 3F 00 F0 00 3F 00 00 00??
  • 0020 41 29 54 02 3E 25 00 00 A ) T > %
  • 0040 80 01 29 F1 17 79 2D 4E ) y - N
  • 0048 4F 20 4E 41 4D 45 20 20 O N A M E
  • 0050 20 20 46 41 54 33 32 20 F A T
  • 0058 20 20 33 C9 8E D1 BC F4
  • 0060 7B 8E C1 8E D9 BD 00 7C { |
  • 0068 88 4E 02 8A 56 40 B4 08 N V @
  • 0070 CD 13 73 05 B9 FF FF 8A s
  • 0078 F1 66 0F B6 C6 40 66 0F f @ f
  • 0080 B6 D1 80 E2 3F F7 E2 86?
  • 0088 CD C0 ED 06 41 66 0F B7 A f
  • 0090 C9 66 F7 E1 66 89 46 F8 f f F
  • 0098 83 7E 16 00 75 38 83 7E ~ u 8 ~
    • Offset 16 = 0x10 = Count of FAT’S = 0x Copies of FAT
  • 0000 EB 58 90 4D 53 57 49 4E X M S W I N
  • 0008 34 2E 31 00 02 20 24 00 4 1 $
  • 0010 02 00 00 00 00 F8
  • 0018 3F 00 F0 00 3F 00 00 00??
  • 0020 41 29 54 02 3E 25 00 00 A ) T > %
  • 0040 80 01 29 F1 17 79 2D 4E ) y - N
  • 0048 4F 20 4E 41 4D 45 20 20 O N A M E
  • 0050 20 20 46 41 54 33 32 20 F A T
  • 0058 20 20 33 C9 8E D1 BC F4
  • 0060 7B 8E C1 8E D9 BD 00 7C { |
  • 0068 88 4E 02 8A 56 40 B4 08 N V @
  • 0070 CD 13 73 05 B9 FF FF 8A s
  • 0078 F1 66 0F B6 C6 40 66 0F f @ f
  • 0080 B6 D1 80 E2 3F F7 E2 86?
  • 0088 CD C0 ED 06 41 66 0F B7 A f
  • 0090 C9 66 F7 E1 66 89 46 F8 f f F
  • 0098 83 7E 16 00 75 38 83 7E ~ u 8 ~
  • 0000 EB 58 90 4D 53 57 49 4E X M S W I N Offset 36 = 0x24 = Sectors occupied by single FAT = 0x0000253E
  • 0008 34 2E 31 00 02 20 24 00 4 1 $
  • 0010 02 00 00 00 00 F8
  • 0018 3F 00 F0 00 3F 00 00 00??
  • 0020 41 29 54 02 3E 25 00 00 A ) T > %
  • 0040 80 01 29 F1 17 79 2D 4E ) y - N
  • 0048 4F 20 4E 41 4D 45 20 20 O N A M E
  • 0050 20 20 46 41 54 33 32 20 F A T
  • 0058 20 20 33 C9 8E D1 BC F4
  • 0060 7B 8E C1 8E D9 BD 00 7C { |
  • 0068 88 4E 02 8A 56 40 B4 08 N V @
  • 0070 CD 13 73 05 B9 FF FF 8A s
  • 0078 F1 66 0F B6 C6 40 66 0F f @ f
  • 0080 B6 D1 80 E2 3F F7 E2 86?
  • 0088 CD C0 ED 06 41 66 0F B7 A f
  • 0090 C9 66 F7 E1 66 89 46 F8 f f F
  • 0098 83 7E 16 00 75 38 83 7E ~ u 8 ~
    • Offset 44 = 0x2C = 0x0000 Cluster # for Root Directory
  • 0000 EB 58 90 4D 53 57 49 4E X M S W I N
  • 0008 34 2E 31 00 02 20 24 00 4 1 $
  • 0010 02 00 00 00 00 F8
  • 0018 3F 00 F0 00 3F 00 00 00??
  • 0020 41 29 54 02 3E 25 00 00 A ) T > %
  • 0040 80 01 29 F1 17 79 2D 4E ) y - N
  • 0048 4F 20 4E 41 4D 45 20 20 O N A M E
  • 0050 20 20 46 41 54 33 32 20 F A T
  • 0058 20 20 33 C9 8E D1 BC F4
  • 0060 7B 8E C1 8E D9 BD 00 7C { |
  • 0068 88 4E 02 8A 56 40 B4 08 N V @
  • 0070 CD 13 73 05 B9 FF FF 8A s
  • 0078 F1 66 0F B6 C6 40 66 0F f @ f
  • 0080 B6 D1 80 E2 3F F7 E2 86?
  • 0088 CD C0 ED 06 41 66 0F B7 A f
  • 0090 C9 66 F7 E1 66 89 46 F8 f f F
  • 0098 83 7E 16 00 75 38 83 7E ~ u 8 ~

To examine the contents of a file first a file is created whose contents are also shown in

the slide.

Creation of a File on Root

Directory

and is stored as myfile.txt on the root directory.

Creation of a File on Root

Directory

Now we examine the contents of cluster number 2 which contains the root directory as

already seen in the previous slides.

000000000000 0000 E5 41 47 45 46 49 4C 45 53 59 53 26 00 3B A2 31 .AGEFILESYS&.;.
000000000010 0010 A8 32 84 33 00 00 53 4E 84 33 03 00 00 60 01 00 .2.3..SN.3...`..
000000000020 0020 57 49 4E 44 4F 57 53 20 20 20 20 10 00 4C A2 31 WINDOWS ..L.
000000000030 0030 A8 32 21 34 00 00 A3 31 A8 32 03 0A 00 00 00 00 .2!4...1.2......

000000000040 0040 4E 54 4C 44 52 20 20 20 20 20 20 27 08 00 71 A7 NTLDR '..q. 000000000050 0050 03 31 A8 32 00 00 71 A7 03 31 85 8E B0 D0 03 00 .1.2..q..1...... 000000000060 0060 4E 54 44 45 54 45 43 54 43 4F 4D 27 00 00 D1 A4 NTDETECTCOM'.... 000000000070 0070 03 31 A8 32 00 00 D1 A4 03 31 9E 8F CC B9 00 00 .1.2.....1...... 000000000080 0080 42 4F 4F 54 20 20 20 20 49 4E 49 06 18 30 25 32 BOOT INI..0% 000000000090 0090 A8 32 21 34 0E 00 5C 33 A8 32 F0 AD D3 00 00 00 .2!4..\3.2...... 0000000000A0 00A0 42 20 00 53 00 65 00 74 00 74 00 0F 00 4A 69 00 B .S.e.t.t...Ji. 0000000000B0 00B0 6E 00 67 00 73 00 00 00 FF FF 00 00 FF FF FF FF n.g.s........... 0000000000C0 00C0 01 44 00 6F 00 63 00 75 00 6D 00 0F 00 4A 65 00 .D.o.c.u.m...Je.

Cluster # 2

0000000034E0 34E0 E5 59 46 49 4C 45 20 20 54 58 54 20 18 67 CC 16 .YFILE TXT .g.. 0000000034F0 34F0 21 34 21 34 00 00 CD 16 21 34 00 00 00 00 00 00 !4!4....!4...... 000000003500 3500 4D 59 46 49 4C 45 20 20 54 58 54 20 18 67 CC 16 MYFILE TXT .g.. 000000003510 3510 21 34 21 34 09 00 CD 16 21 34 C9 29 29 00 00 00 !4!4....!4.))... 000000003520 3520 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000000003530 3530 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

From the information from above slides the low and high words of the first cluster

number is obtained and is shown in the slide below. The higher 4 bits of the cluster

number should be ignored as discussed earlier.

File Data

Dump of LSN 19235712

0000 74 68 69 73 20 69 73 20 t h i s i s 116 104 105 11 5 32 105 115 32 0008 66 69 6C 65 20 74 6F 20 f i l e t o 102 105 108 10 1 32 116 111 32 0010 74 65 73 74 20 46 41 54 t e s t F A T 116 101 115 11 6 32 70 65 84 0018 33 32 20 66 69 6C 65 20 3 2 f i l e 51 50 32 10 2 105 108 101 32 0020 73 74 72 75 63 74 75 72 s t r u c t u r 115 116 114 11 7 99 116 117 114 0028 65 00 00 00 00 00 00 00 e....... 101 0 0 0 0 0 0 0 0030 00 00 00 00 00 00 00 00........ 0 0 0 0 0 0 0 0 0038 00 00 00 00 00 00 00 00........ 0 0 0 0 0 0 0 0 0040 00 00 00 00 00 00 00 00........ 0 0 0 0 0 0 0 0 0048 00 00 00 00 00 00 00 00........ 0 0 0 0 0 0 0 0 0050 00 00 00 00 00 00 00 00........ 0 0 0 0 0 0 0 0 0058 00 00 00 00 00 00 00 00........ 0 0 0 0 0 0 0 0 0060 00 00 00 00 00 00 00 00........ 0 0 0 0 0 0 0 0 0068 00 00 00 00 00 00 00 00........ 0 0 0 0 0 0 0 0 0070007800800088 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... ..... ... .. (^0000 0 0 0 0 0000 0000 0000 0000 0 0 0 0 ) (^00900098) 00A0 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... .. (^000 0 0 0 000 000 000 000 0 0 0 ) 00A800B000B8 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... .. (^000 0 0 0 000 000 000 000 0 0 0 ) 00C000C800D000D8 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... ..... ... .. (^0000 0 0 0 0 0000 0000 0000 0000 0 0 0 0 ) 00E000E800F0 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... .. (^000 0 0 0 000 000 000 000 0 0 0 ) 00F8 010001080110 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... ..... ... .. (^0000 0 0 0 0 0000 0000 0000 0000 0 0 0 0 ) 011801200128 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... .. (^000 0 0 0 000 000 000 000 0 0 0 ) 0130013801400148 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... ..... ... .. (^0000 0 0 0 0 0000 0000 0000 0000 0 0 0 0 ) 015001580160 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... .. (^000 0 0 0 000 000 000 000 0 0 0 ) 016801700178 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... .. (^000 0 0 0 000 000 000 000 0 0 0 ) 0180018801900198 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... ..... ... .. (^0000 0 0 0 0 0000 0000 0000 0000 0 0 0 0 ) 01A001A801B0 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... .. (^000 0 0 0 000 000 000 000 0 0 0 ) 01B801C001C8 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... .. (^000 0 0 0 000 000 000 000 0 0 0 ) 01D001D801E001E8 0000 0000 0000 00000000 0000 0000 00000000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... ..... ... ..... ... .. (^0000 0 0 0 0 0000 0000 0000 0000 0 0 0 0 ) 01F001F8 0000 0000 0000 00000000 0000 0000 0000 ... ... ..... ... .. (^00 0 0 00 00 00 00 0 0 )

In the FAT32 there is another special reserved block called FSInfo sector. The block

contains some information required by the operating system while cluster

allocation/deallocation to files. This information is also critical for FAT16 based systems.

But in FAT12 and 16 this information is calculated when ever required. This calculation

at the time of allocation is not feasible in FAT32 as the size of FAT32 is very large and

such calculations will consume a lots of time, so to save time this information is stored in

the FSInfo block and is updated at the time of allocation/deallocation.