Logical File Storage: File Structures Non-structured files: stream / byte files Structured files: fixed structure record files fields bytes structured sub-files separate header, data areas (e.g. object files) data bases
Logical File Storage: Access Methods Sequential stream or fixed structure records in general, re-write of a single record is not possible Direct Byte Offset Direct Record must be fixed structure records re-write of a single record common Database
Physical Disk Storage: Track Sectors There are the same number of sectors on the (shorter) inside tracks as on the longer (outside) tracks. The amount of data stored depends upon the transfer rate and not the length of the area. However, this may mean that inside tracks are more prone to errors.
Physical Disk Storage: Physical Record/Sector Location Drive ID Cylinder Number how far to move the access arm in Surface Number with the cylinder number identifies a specific track Track-Sector Number established by FORMAT (sector ID & data area)
Physical Disk Storage: Disk Controller Commands Commands which must be sent to a disk controller to read/write a sector Drive select (Start Rotation) Arm Position Seek Sector ID Begin Transfer
Translation of Logical File IO To Physical Disk IO : Open File (for a file at the root) Root directory (at a fixed physical location) is read into memory Directory entries include file name and physical starting location If a match is found with the file to be opened, a pointer is saved to the beginning of the file space (for a file not at the root, each subdirectory from the root down to the directory containing the file must be read)
Translation of Logical File IO To Physical Disk IO : Read Record If the buffer area (the area containing a copy of the disk sector) is empty, commands are sent to the disk controller to read the sector at the disk pointer location and the disk pointer is updated to point at the next sector which is part of this file. An area equal in size to the logical record is copied from the buffer area to the logical record area and an internal buffer pointer is updated.
Translation of Logical File IO To Physical Disk IO : Next Sector Location of the next sector in a file can be achieved by: forcing the file to be stored in contiguous locations; or storing the sectors as a linked list, with each sector containing a pointer field to the next sector in this file; or storing an array of next sector pointers external to the sectors. The directory often contains a file length which can be used in determining when the end of file has been reached.
Translation of Logical File IO To Physical Disk IO : The Directory Typical directory entries (depending upon the operating system) contain: file name file length physical disk start location time & date last modified/last accessed/created various file attributes (normal, hidden, etc.)
File Allocation Units When space is required to store data which is part of a file, disk space is normally allocated (by the operating system) more than a single sector at a time; linking of the parts of a file together will typically be based on these larger groups, instead of on individual sectors. These allocation units are sometimes called clusters or granules.
File Starting Location The file starting location is often specified as an allocation unit (or cluster) number, instead of a cylinder/surface/track-sector set of values. Conversion of an allocation unit requires knowledge of the number of sectors per track and the number of tracks (surfaces) per cylinder; these pieces of information are contained as part of the data in the disks boot sector.
File Starting Location: Example What is the physical starting location of a file at allocation unit 50? Suppose we know the following (from the boot sector) 4 sectors / allocation unit (for all allocations) 12 sectors / track 8 tracks (surfaces)/cylinder Allocation unit 50 would be 200 (4x50) sectors from the beginning of the disk There are 96 (12x8) sectors per cylinder 200 sectors from the start of the disk represents 2 full cylinders plus an additional 8 sectors The file would start on the third cylinder, on the first surface, and the eighth track-sector.