Lecture # 36: System Programming Course Code: CS609 Cs609@vu - Edu.pk
Lecture # 36: System Programming Course Code: CS609 Cs609@vu - Edu.pk
Cs609@[Link]
Lecture # 36
Now converting all those cluster number in previous lecture into LSN we get the starting
LSN for each cluster.
For cluster # 0009H and 55h
Contents of FILE
-l 1000 5 1f8 8
-d 1000
-d 1000
Cont…
-l 1000 5 460 8
-d 1000
-l 1000 5 468 8
-d 1000
-d 1000 5000
13A6:1000 4E 45 57 20 56 4F 4C 55-4D 45 20 08 00 00 00 00 NEW VOLUME .....
13A6:1010 00 00 00 00 00 00 61 76-2D 33 00 00 00 00 00 00 ......av-3......
13A6:1020 41 52 00 65 00 63 00 79-00 63 00 0F 00 21 6C 00 AR.e.c.y.c...!l.
13A6:1030 65 00 64 00 00 00 FF FF-FF FF 00 00 FF FF FF FF e.d.............
13A6:1040 52 45 43 59 43 4C 45 44-20 20 20 16 00 4E 79 5E RECYCLED ..Ny^
13A6:1050 2F 33 2F 33 00 00 7A 5E-2F 33 02 00 00 00 00 00 /3/3..z^/3......
13A6:1060 42 20 00 49 00 6E 00 66-00 6F 00 0F 00 72 72 00 B .I.n.f.o...rr.
13A6:1070 6D 00 61 00 74 00 69 00-6F 00 00 00 6E 00 00 00 m.a.t.i.o...n...
13A6:1080 01 53 00 79 00 73 00 74-00 65 00 0F 00 72 6D 00 .S.y.s.t.e...rm.
13A6:1090 20 00 56 00 6F 00 6C 00-75 00 00 00 6D 00 65 00 .V.o.l.u...m.e.
13A6:10A0 53 59 53 54 45 4D 7E 31-20 20 20 16 00 4E 79 5E SYSTEM~1 ..Ny^
13A6:10B0 2F 33 2F 33 00 00 7A 5E-2F 33 03 00 00 00 00 00 /3/3..z^/3......
13A6:10C0 41 64 00 50 00 62 00 31-00 2E 00 0F 00 6A 74 00 Ad.P.b.1.....jt.
13A6:10D0 78 00 74 00 00 00 FF FF-FF FF 00 00 FF FF FF FF x.t.............
13A6:10E0 44 50 42 31 20 20 20 20-54 58 54 20 00 57 81 69 DPB1 TXT .W.i
13A6:10F0 36 33 36 33 00 00 07 78-36 33 0A 00 8A 06 00 00 6363...x63......
13A6:1100 44 50 42 32 20 20 20 20-54 58 54 20 18 12 AE 69 DPB2 TXT ...i
13A6:1110 36 33 36 33 00 00 03 75-36 33 0B 00 5F 06 00 00 6363...u63.._...
13A6:1120 46 49 52 53 54 20 20 20-20 20 20 10 08 6F ED 56 FIRST ..o.V
13A6:1130 3C 33 3C 33 00 00 EE 56-3C 33 0C 00 00 00 00 00 <3<3...V<3......
13A6:1140 53 45 43 4F 4E 44 20 20-20 20 20 10 08 50 EF 56 SECOND ..P.V
13A6:1150 3C 33 3C 33 00 00 F0 56-3C 33 12 00 00 00 00 00 <3<3...V<3......
13A6:1160 54 48 49 52 44 20 20 20-20 20 20 10 08 1B F1 56 THIRD ....V
13A6:1170 3C 33 3C 33 00 00 F2 56-3C 33 13 00 00 00 00 00 <3<3...V<3......
Cont…
13A6:1180 E5 52 45 45 20 20 20 20-54 58 54 20 18 89 4C 57 .REE TXT ..LW
13A6:1190 3C 33 3C 33 00 00 4D 57-3C 33 1D 00 F8 00 00 00 <3<3..MW<3......
13A6:11A0 E5 52 56 50 42 46 20 20-54 58 54 20 18 85 43 6C .RVPBF TXT ..Cl
13A6:11B0 3C 33 3C 33 00 00 62 6C-3C 33 10 00 AF 00 00 00 <3<3..bl<3......
13A6:11C0 E5 52 56 50 42 46 20 20-54 58 54 20 18 08 BB 6C .RVPBF TXT ...l
13A6:11D0 3C 33 3C 33 00 00 83 6D-3C 33 10 00 BA 04 00 00 <3<3...m<3......
13A6:11E0 E5 4F 4F 54 46 20 20 20-54 58 54 20 18 45 D3 6D .OOTF TXT .E.m
13A6:11F0 3C 33 3C 33 00 00 F8 6D-3C 33 11 00 6F 4F 00 00 <3<3...m<3..oO..
13A6:1200 E5 4F 4F 54 46 20 20 20-54 58 54 20 18 04 CF 6E .OOTF TXT ...n
13A6:1210 3C 33 3C 33 00 00 F8 6D-3C 33 1D 00 6F 4F 00 00 <3<3...m<3..oO..
13A6:1220 44 52 56 50 42 46 20 20-54 58 54 20 18 04 CF 6E DRVPBF TXT ...n
13A6:1230 3C 33 3C 33 00 00 83 6D-3C 33 22 00 BA 04 00 00 <3<3...m<3".....
13A6:1240 54 52 45 45 20 20 20 20-54 58 54 20 18 05 CF 6E TREE TXT ...n
13A6:1250 3C 33 3C 33 00 00 4D 57-3C 33 23 00 F8 00 00 00 <3<3..MW<3#.....
13A6:1260 52 4F 4F 54 46 20 20 20-54 58 54 20 18 04 CF 6E ROOTF TXT ...n
13A6:1270 3C 33 3C 33 00 00 36 73-3C 33 24 00 67 ED 00 00 <3<3..6s<3$.g...
13A6:1280 E5 5F 41 4E 53 20 20 20-54 58 54 20 10 9D 7D 6F ._ANS TXT ..}o
13A6:1290 3C 33 3C 33 00 00 60 05-72 28 29 00 4F 8F 00 00 <3<3..`.r().O...
13A6:12A0 E5 43 00 70 00 61 00 70-00 65 00 0F 00 54 72 00 .C.p.a.p.e...Tr.
13A6:12B0 2E 00 74 00 78 00 74 00-00 00 00 00 FF FF FF FF ..t.x.t.........
13A6:12C0 E5 50 41 50 45 52 20 20-54 58 54 20 00 9D 7D 6F .PAPER TXT ..}o
13A6:12D0 3C 33 3D 33 00 00 60 05-72 28 29 00 4F 8F 00 00 <3=3..`.r().O...
13A6:12E0 E5 6D 00 65 00 6E 00 74-00 2E 00 0F 00 9F 74 00 .m.e.n.t......t.
13A6:12F0 78 00 74 00 00 00 FF FF-FF FF 00 00 FF FF FF FF x.t.............
13A6:1300 E5 4E 00 65 00 77 00 20-00 54 00 0F 00 9F 65 00 .N.e.w. .T....e.
13A6:1310 78 00 74 00 20 00 44 00-6F 00 00 00 63 00 75 00 x.t. .D.o...c.u.
Cont…
13A6:1320 E5 45 57 54 45 58 7E 31-54 58 54 20 00 32 09 73 .EWTEX~1TXT .2.s
13A6:1330 3C 33 3C 33 00 00 0A 73-3C 33 00 00 00 00 00 00 <3<3...s<3......
13A6:1340 54 45 53 54 20 20 20 20-54 58 54 20 18 32 09 73 TEST TXT .2.s
13A6:1350 3C 33 3C 33 00 00 17 73-3C 33 45 00 27 00 00 00 <3<3...s<3E.'...
13A6:1360 46 49 4C 45 20 20 20 20-54 58 54 20 18 81 83 73 FILE TXT ...s
13A6:1370 3C 33 3C 33 00 00 8D 73-3C 33 54 00 99 02 00 00 <3<3...s<3T.....
13A6:1380 E5 30 58 58 20 20 20 20-54 4D 50 20 18 65 A6 68 .0XX TMP .e.h
13A6:1390 3D 33 3D 33 00 00 A7 68-3D 33 08 00 12 63 00 00 =3=3...h=3...c..
13A6:13A0 41 43 00 70 00 61 00 70-00 65 00 0F 00 54 72 00 AC.p.a.p.e...Tr.
13A6:13B0 2E 00 74 00 78 00 74 00-00 00 00 00 FF FF FF FF ..t.x.t.........
13A6:13C0 43 50 41 50 45 52 20 20-54 58 54 20 00 9D 7D 6F CPAPER TXT ..}o
13A6:13D0 3C 33 3D 33 00 00 A7 68-3D 33 08 00 12 63 00 00 <3=3...h=3...c..
13A6:13E0 46 44 50 42 20 20 20 20-54 58 54 20 18 05 56 69 FDPB TXT ..Vi
13A6:13F0 3D 33 3D 33 00 00 BD 69-3D 33 29 00 BA 04 00 00 =3=3...i=3).....
13A6:1400 46 44 44 20 20 20 20 20-54 58 54 20 18 48 E4 75 FDD TXT .H.u
13A6:1410 3D 33 3D 33 00 00 23 76-3D 33 2A 00 13 00 00 00 =3=3..#v=3*.....
Now lets just analyse the contents of root directory of the same volume. If the DIR
command is performed on the same volume its result will be as below. Note the entry for
file named [Link]
Directory of F:\
Now on the same volume the file [Link] is deleted. Lets analyse the contents of the
root directory now.
-d1000 5000
Cont…
13A6:1180 E5 52 45 45 20 20 20 20-54 58 54 20 18 89 4C 57 .REE TXT ..LW
13A6:1190 3C 33 3C 33 00 00 4D 57-3C 33 1D 00 F8 00 00 00 <3<3..MW<3......
13A6:11A0 E5 52 56 50 42 46 20 20-54 58 54 20 18 85 43 6C .RVPBF TXT ..Cl
13A6:11B0 3C 33 3C 33 00 00 62 6C-3C 33 10 00 AF 00 00 00 <3<3..bl<3......
13A6:11C0 E5 52 56 50 42 46 20 20-54 58 54 20 18 08 BB 6C .RVPBF TXT ...l
13A6:11D0 3C 33 3C 33 00 00 83 6D-3C 33 10 00 BA 04 00 00 <3<3...m<3......
13A6:11E0 E5 4F 4F 54 46 20 20 20-54 58 54 20 18 45 D3 6D .OOTF TXT .E.m
13A6:11F0 3C 33 3C 33 00 00 F8 6D-3C 33 11 00 6F 4F 00 00 <3<3...m<3..oO..
13A6:1200 E5 4F 4F 54 46 20 20 20-54 58 54 20 18 04 CF 6E .OOTF TXT ...n
13A6:1210 3C 33 3C 33 00 00 F8 6D-3C 33 1D 00 6F 4F 00 00 <3<3...m<3..oO..
13A6:1220 44 52 56 50 42 46 20 20-54 58 54 20 18 04 CF 6E DRVPBF TXT ...n
13A6:1230 3C 33 3C 33 00 00 83 6D-3C 33 22 00 BA 04 00 00 <3<3...m<3".....
13A6:1240 54 52 45 45 20 20 20 20-54 58 54 20 18 05 CF 6E TREE TXT ...n
13A6:1250 3C 33 3C 33 00 00 4D 57-3C 33 23 00 F8 00 00 00 <3<3..MW<3#.....
13A6:1260 52 4F 4F 54 46 20 20 20-54 58 54 20 18 04 CF 6E ROOTF TXT ...n
13A6:1270 3C 33 3C 33 00 00 36 73-3C 33 24 00 67 ED 00 00 <3<3..6s<3$.g...
13A6:1280 E5 5F 41 4E 53 20 20 20-54 58 54 20 10 9D 7D 6F ._ANS TXT ..}o
13A6:1290 3C 33 3C 33 00 00 60 05-72 28 29 00 4F 8F 00 00 <3<3..`.r().O...
13A6:12A0 E5 43 00 70 00 61 00 70-00 65 00 0F 00 54 72 00 .C.p.a.p.e...Tr.
13A6:12B0 2E 00 74 00 78 00 74 00-00 00 00 00 FF FF FF FF ..t.x.t.........
13A6:12C0 E5 50 41 50 45 52 20 20-54 58 54 20 00 9D 7D 6F .PAPER TXT ..}o
13A6:12D0 3C 33 3D 33 00 00 60 05-72 28 29 00 4F 8F 00 00 <3=3..`.r().O...
13A6:12E0 E5 6D 00 65 00 6E 00 74-00 2E 00 0F 00 9F 74 00 .m.e.n.t......t.
13A6:12F0 78 00 74 00 00 00 FF FF-FF FF 00 00 FF FF FF FF x.t.............
13A6:1300 E5 4E 00 65 00 77 00 20-00 54 00 0F 00 9F 65 00 .N.e.w. .T....e.
13A6:1310 78 00 74 00 20 00 44 00-6F 00 00 00 63 00 75 00 x.t. .D.o...c.u.
The entry for [Link] still exists as can be seen from the next slide. The only
difference that have occurred is that the first character has been replaced by a byte with
the value 0xE5
Cont…
13A6:1320 E5 45 57 54 45 58 7E 31-54 58 54 20 00 32 09 73 .EWTEX~1TXT .2.s
13A6:1330 3C 33 3C 33 00 00 0A 73-3C 33 00 00 00 00 00 00 <3<3...s<3......
13A6:1340 E5 45 53 54 20 20 20 20-54 58 54 20 18 32 09 73 .EST TXT .2.s
13A6:1350 3C 33 3C 33 00 00 17 73-3C 33 45 00 27 00 00 00 <3<3...s<3E.'...
13A6:1360 46 49 4C 45 20 20 20 20-54 58 54 20 18 81 83 73 FILE TXT ...s
13A6:1370 3C 33 3C 33 00 00 8D 73-3C 33 54 00 99 02 00 00 <3<3...s<3T.....
13A6:1380 E5 30 58 58 20 20 20 20-54 4D 50 20 18 65 A6 68 .0XX TMP .e.h
13A6:1390 3D 33 3D 33 00 00 A7 68-3D 33 08 00 12 63 00 00 =3=3...h=3...c..
13A6:13A0 41 43 00 70 00 61 00 70-00 65 00 0F 00 54 72 00 AC.p.a.p.e...Tr.
13A6:13B0 2E 00 74 00 78 00 74 00-00 00 00 00 FF FF FF FF ..t.x.t.........
13A6:13C0 43 50 41 50 45 52 20 20-54 58 54 20 00 9D 7D 6F CPAPER TXT ..}o
13A6:13D0 3C 33 3D 33 00 00 A7 68-3D 33 08 00 12 63 00 00 <3=3...h=3...c..
13A6:13E0 46 44 50 42 20 20 20 20-54 58 54 20 18 05 56 69 FDPB TXT ..Vi
13A6:13F0 3D 33 3D 33 00 00 BD 69-3D 33 29 00 BA 04 00 00 =3=3...i=3).....
13A6:1400 46 44 44 20 20 20 20 20-54 58 54 20 18 48 E4 75 FDD TXT .H.u
13A6:1410 3D 33 3D 33 00 00 31 76-3D 33 2A 00 67 3C 01 00 =3=3..1v=3*.g<..
13A6:1420 E5 46 41 54 20 20 20 20-54 58 54 20 18 96 2C 78 .FAT TXT ..,x
13A6:1430 3D 33 3D 33 00 00 37 78-3D 33 6D 00 1A 05 00 00 =3=3..7x=3m.....
13A6:1440 46 46 41 54 20 20 20 20-54 58 54 20 18 96 2C 78 FFAT TXT ..,x
13A6:1450 3D 33 3D 33 00 00 50 78-3D 33 6E 00 19 05 00 00 =3=3..Px=3n.....
13A6:1460 46 46 49 4C 45 20 20 20-54 58 54 20 18 11 97 78 FFILE TXT ...x
13A6:1470 3D 33 3D 33 00 00 D3 78-3D 33 6D 00 61 0A 00 00 =3=3...x=3m.a...
13A6:1480 44 49 52 20 20 20 20 20-54 58 54 20 18 49 9A 7E DIR TXT .I.~
13A6:1490 3D 33 3D 33 00 00 9B 7E-3D 33 6F 00 AC 03 00 00 =3=3...~=3o.....
13A6:14A0 44 49 52 44 20 20 20 20-54 58 54 20 18 7B C0 7E DIRD TXT .{.~
13A6:14B0 3D 33 3D 33 00 00 C1 7E-3D 33 45 00 AC 03 00 00 =3=3...~=3E.....
13A6:14C0 44 44 44 45 4C 20 20 20-54 58 54 20 18 49 F7 7E DDDEL TXT .I.~
13A6:14D0 3D 33 3D 33 00 00 F8 7E-3D 33 70 00 13 00 00 00 =3=3...~=3p.....
But when the DIR command execute on the same volume the file does not show.
Directory of F:\
Now lets see the contents of the file by converting the first cluster number in the FCB
into LSN and taking its dump. We get the following slide.
-d 1000
Deleted Files
• 0xE5 at the start of file entry is used to mark the
file as deleted.
• The contents of file still remain on disk.
• The contents can be recovered by placing a valid
file name, character in place of E5 and then
recovering the chain of file in FAT.
• If somehow the clusters used by deleted file has
been overwritten by some other file, it cannot be
recovered.
Not only the file is marked for deletion but also the chain of its cluster in FAT is
reclaimed by putting zeros in there place. This also indicate that these clusters are now
free.
Now lets have some discussion about sub-directories. In the contents of the above given
root directory notice an entry named SECOND. The attribute byte of this entry is 0x20
which indicates that it’s a directory, the size is 0 which shows that there is now user data
in it, but even though the size 0 its has a first cluster which is 0x12. Converting 0x12 into
LSN and then reading its contents we get the following dump. This shows that this cluster
contains the FCBs for all the file and folders within this directory.
Contents of Sub-Directories
-l 1000 5 240 8
-d 1000
-l 1000 5 268 8
-d 1000
In the entries within SECOND we see an entry SUB2. Its starting cluster is 0017H. This
value is converted into LSN and the contents read. The slide above also show the
contents of SUB2.
Similarly the following slide shows the contents of SUB3 within SUB2 and the contents
of SUB4 within SUB3.
Cont…
-l 1000 5 270 8
-d 1000
-l 1000 5 278 8
-d 1000
The following slide shows the contents of SUB5 and also the contents of file
[Link] in SUB5.
Cont…
-l 1000 5 280 8
-d 1000
-l 1000 5 288 8
-d 1000
In all the sub-directories one thing is worth noticing. The first two entries are the . and ..
entries. These two are special entries as described in the slide below.
Notice the contents of SECOND directory. The . entry has the cluster number 0012H
which is the cluster number for the SECOND directory and the .. entry has cluster
number which indicates the higher level directory which is the root directory.
. and .. Sub-Directories
-l 1000 5 240 8
-d 1000
-l 1000 5 268 8
-d 1000
Also examine the contents of SUB2 directory the . directory has cluster number 0017h
which the cluster number for SUB2 and the .. entry has the cluster number 0012H which
is the cluster number of its parent directory SECOND
Virtual University of Pakistan 38
System Programming Course Code: CS609
Cs609@[Link]
Same can be observed for SUB3, SUB4, SUB5 or any other sub-directory in question.
Cont…
-l 1000 5 270 8
-d 1000
-l 1000 5 278 8
-d 1000
So this how CD. command gives the current path and CD.. moves to the one higher level
directory.