Disk Storage Capacity and File System Calculations
Track Capacity: Number of sectors per track * Bytes per sector
Cylinder Capacity: Number of tracks per cylinder * Track capacity
Drive Capacity: Number of cylinders * Cylinder capacity
Transfer Time: (Number of bytes transferred / Number of bytes on track) * Rotation time
FAT Size: (Number of blocks * 6) / (Block size + 1)
Magnetic Tape
Density: #bytes/inch (bpi)
S: (Block length + gap) * n (# of blocks)
Block Length: (#bytes / bpi = bytes/inch)
Example Calculations
- 170 sectors/track
- 16 tracks/cylinder
- (16 surfaces)
- How many platters: 9
What is the track capacity?
170 * 512
What is the cylinder capacity?
(170 * 512) * 16
What is the total capacity?
((170 * 512) * 16) * 6526
What is the max rotational delay?
rps = 10000 / 60 = 166.6, period = (1 / 166.6)
What is the average rotational delay?
1/2 * (1 / 166.6)
What is transfer time (1 block)?
(1 / 166.6) * (1 / 170)
What is the max transfer rate?
(170 * 512) * 10000 rpm
Disk Drive Example
A disk drive has 16384 cylinders, 1024 sectors, 16 surfaces, and 512 bytes/block and spins at 12000rpm.
What is the storage capacity of the disk?
1024 * 512 → cylinder capacity = (1024 * 512) * 16 → total = ((1024 * 512) * 16) * 16384
What is the max rotational delay?
rps = 12000 / 60, (1 / (12000 / 60)) = (60 / 12000) = (1 / 200)
What is the maximum data transfer rate?
(1024 * 512) * (12000 / 60)
Floppy Disk Example
A floppy has two sides, 18 sectors/track, 80 tracks, and 512 byte blocks.
a. If DOS has 12 bit block addresses, how many blocks are needed to store the FAT?
(18) * 80 * 2 = [(2880 * 12) / 8] / 512
b. If every i-node in Unix has 10 direct addresses, 1 indirect address, and 1 double indirect address, what is the size of the largest file?
(512 * 8) / 12 → double indirect ((512 * 8) / 12)^2 → 341^2
File System Size
A file system is installed on a disk with 1024 byte logical blocks.
If 24 bit block addresses are used what is the maximum size of the filesystem?
2^24 * 1024 = 2^34
If the block size is increased to 4096, then what is the maximum file system size?
2^24 * 4096 = 2^24 * 2^12 = 2^36
Key Concepts
Key-collection of 1 or more fields
Primary key-key uniquely identifies record
Secondary key- not primary
Normalization-used to remove redundancy, data integrity
Data compression- every file must have at least n*H bits.
Linux | Window |
---|---|
database collection of files | tables |
file collection of records | rows |
record collection | columns |
When a record is stored in memory, we refer to it as an object and refer to its fields as member
Primary keys should be dataless
Primary keys should be unchanging
Relative record number (RRN)
Header record contains integer fields that record the header record size, the number of data records, and the data record size
Wasted space within a record is called internal fragmentation.
External fragmentation- blocks for one file are distributed across many different cylinders
Internal Fragmentation- occurs when there is wasted space within a record
Cluster-logical block 2^7 512 byte blocks
Shell commands for DOS: touch-creates a file, cat-output a file, rm-delete a file, cp-copy a file to another file, mv-mv file1 to file2
External Fragmentation- occurs when holes of unused space between records are created, normally because of record deletions