============================== Assignment #09 - Disk Geometry ============================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com If not specifically told otherwise, assume that a "sector" is 512 bytes. 1. How many MBytes does a disk hold if C/H/S = 512/6/20? ANSWER: 31457280 = 512*6*20*512 bytes 30 MB = 31457280 / (1024 * 1024) 2. True/False: A program writing 10,000 bytes to a disk will create a 10,000-byte sector on the disk to hold the data. ANSWER: FALSE REASON: Disks have fixed hardware sector sizes. Large writes are split into sector-size chunks when written to the disk. Often the last sector written will be only partially full. 3. Why do many file systems use "allocation units" instead of single sectors? ANSWER: Keeping track of individual sectors requires large numbers; using clustering keeps the numbers smaller. Allocating in clusters also help control fragmentation of the file, since the entire cluster is usually stored contiguously on the disk. 4. On a Windows system with a cluster size of 32, how much space (on average) is wasted at the end of every file on the disk? Answer in KBytes. ANSWER: On average, half a cluster (32/2 sectors) is wasted for every file. 16 sectors -> 16 * 512 -> 16 * (1/2 KB) -> 8KB wasted per file 5. True/False: With "Contiguous Space Allocation" it is possible to have 20 sectors of free space but still be unable to allocate a 10-sector file. ANSWER: TRUE REASON: Contiguous allocation requires 10 sectors all in one piece. The disk could be fragmented so that no part of the 20 free sectors was in one 10-sector piece. 6. Using "Extent-Based File Allocation" on a disk with a block of 9 contiguous unused sectors and another block of 8 contiguous unused sectors and no other unused space, what is the largest file possible using these primary/secondary space requests (see 19PhysicalFiles.htm): a) 10 primary, 2 secondary: ANSWER: zero (not possible) b) 8 primary, 4 secondary: ANSWER: 16 = 8 + 4 + 4 c) 5 primary, 5 secondary: ANSWER: 10 = 5 + 5 d) 4 primary, 4 secondary: ANSWER: 16 = 4 + 4 + 4 + 4 e) 4 primary, 3 secondary: ANSWER: 16 = 4 + 3 + 3 + 3 + 3 f) 2 primary, 1 secondary: ANSWER: 17 = 2 + 15*1 7. How many bytes are used by the Boot Sector (Boot Block) on most disk drives? ANSWER: 512 bytes (one sector) 8. Where is the Boot Sector located on a disk drive? ANSWER: At the very start - absolute sector zero 9. Given the structure of an MS-DOS Boot Sector (19PhysicalFiles.htm): a) What is the maximum size of a sector, in bytes and KBytes? ANSWER: 16 bits unsigned means: max (2**16)-1 bytes = 64KB-1 = 65535 b) What is the maximum number of sectors per cluster? ANSWER: 8 bits unsigned means: max (2**8)-1 sectors = 256-1 = 255 c) What is the maximum number of FAT copies? ANSWER: 8 bits unsigned means: max (2**8)-1 copies = 256-1 = 255 d) What is the maximum number of ROOT directory entries? ANSWER: 16 bits unsigned means: max (2**16)-1 entries = 65535 e) What is the maximum number of sectors per FAT? ANSWER: 16 bits unsigned means: max (2**16)-1 sectors = 65535 f) What is the maximum number of sectors per track? ANSWER: 16 bits unsigned means: max (2**16)-1 sectors = 65535 g) What is the maximum number of heads? ANSWER: 16 bits unsigned means: max (2**16)-1 heads = 65535 h) What is the hex attribute byte value for "Read-Only, Hidden, System"? ANSWER: 07h i) What is the hex attribute byte value for "Subdirectory, Archive Needed"? ANSWER: 30h 10. What is the difference between a track sector number and an absolute sector number? ANSWER: Track sector numbers start at 1 and count sectors around the track on one surface of one platter. Absolute sector numbers start at zero and count all the sectors on the whole disk. 11. If a particular disk has 2 surfaces and 18 sectors/track, what is the C/H/S (Cylinder/Head/Sector) location of absolute disk sector 454 (all values in decimal)? ANSWER: 2*18 = 36 sectors per cylinder 454/36 = 12 full cylinders, 22 sectors left over 22/18 = 1 full track, 4 sectors left over Therefore: 12/1/5 12. From the DUMP given in 20MSDOSDiskStructure.htm, look at the first 32 bytes of the Sample Boot Sector. If memory offset 0x0010 contained 03 instead of 02, what would be the layout of the disk? Fill in the twelve new values in the "What is the layout of this Disk" table: Data Structure Number of Sectors (hex) Start/End Sectors (hex) a) Boot sector b) 1 c) 0 / 0 d) FAT copies (3) e) 3 * F8h = 2E8h f) 1 / 2E8h g) ROOT Directory h) 200*20/200 = 20h i) 2E9h / 308h j) File Allocation Space k) 4 sectors per cluster l) 309h / to end 13. From the DUMP given in 20MSDOSDiskStructure.htm answer these questions about the directory entry for "IO.SYS": a) What are the Attributes of IO.SYS (in English)? ANSWER: 07h -> ReadOnly, Hidden, System b) What is the starting cluster number (in hex and decimal)? ANSWER: 0002h = 2 decimal c) What is the starting absolute sector number (in hex and decimal)? ANSWER: 211h + (0002h-2) * 4 = 211h = (2*256)+16+1 = 529 decimal d) What is the size (in hex and decimal)? ANSWER: 00008296h = 33430 decimal 14. What DEBUG commands loads 10 (decimal) sectors from the floppy disk, starting at absolute sector 25 (decimal) into memory at offset zero? ANSWER: (25 decimal = 16+9 = 19h) L 0 0 19 A 15. What does an MS-DOS Attribute byte value of 0x0F mean? ANSWER: This directory entry is part of a Windows Long Name; the corresponding MS-DOS 8.3 short name follows all the Long Name entries 16. How does MS-DOS/Windows indicate that a file or directory has been deleted? ANSWER: Overwrites the first character of the name (both the Long Name and the short 8.3 name) with E5h