The File System: Files - Long-Term Storage RAM - Short-Term Storage
The File System: Files - Long-Term Storage RAM - Short-Term Storage
Programs, data, and text are all stored in files, which is stored on hard disk and other media, such as tape and floppy disk.
Three kinds: + Regular files, containing a sequence of bytes that generally corresponds to code or data. Referenced via the standard I/O system calls. + Directory files, a special format and forming the backbone of the file system. Referenced only via directory-specific system calls. + Special files, correspond to peripherals such as printers and disks, and interprocess communication mechanisms, such as pipes and sockets. Referenced via the standard I/O system calls.
Disk Architecture
Sector Platter
Track Arm
Block: 4kb
Read/write head
Interleaving
1:1 interleave
8 16 7
1 9 10
2
15
14 13 5 12 4
11
Delay, interleave factor, between each block due to the overhead of the communication between the disk controller and the device driver
Interleaving
1:3 interleave
6 14 3 11
1 9 12
4
16 8 5 13 10 2
15 7
Storing a File
First 4K
Second 4K Last 1K
8 16 15
1 9
10 2
14 13 5 12 4
11
InodesIndex node
To store information about each file + the type of the file: regular, directory, block special, character special, etc. + file permissions + the owner and group IDs + a hard link count + the last modification time and last access time + the location of the blocks if the file is a regular or directory file + the major and minor device numbers if the file is a special file + the value of the symbolic link if the file is a symbolic link
In other words, it contains all of the information when you perform an ls -l, except for the filename
InodesIndex node
Every inode in a particular file system is allocated a unique inode number.
8 16 7 15
1 9 10 2
14 13
11
12 4
Indirect pointer
Disk blocks
Inode
Indirect pointer
Inode 41..80
The Superblock
It contains information pertaining to the entire file system.
+ the total number of blocks in the file system + the number of inodes in the inode free list + the size of a block in bytes + the number of free blocks + the number of used blocks
Disk blocks
Free
Used
Bitmap
1 0 1 1 0 1
Free
Free Used Free
Directories
Inode number 2 contains the location of the block possessing the root directory. (inode number 1 for bad blocks)
label /2 Inode #
.
.. bin
2
2 3 4
bin3
usr4
ls5
cp7
Test.c6
or
/
$unmount /mnt
/
mnt
usr
tmp2