SYSDA lecture 4
File systems- SYSDA lecture 4
File- a named unit of storage, existing persistently
Can be written, read or updated
e.g. word document
manipulated by system calls which are primitive operations:
create
delete
open
close
read
write
seek
current file position
open file, read 200 bytes, then read 100 bytes
create file- write 100 bytes, write 100 bytes
You can also:
Get attributes
Set attributes
Rename a file
Files contain metadata
Type, size, protection, time, date etc are all held regarding a specific file but is not considered part of content
Directories
Special type of file
Contains a list of names of some other files, along with references to those files
e.g. home/pictures that contains files in pictures directory
unix ecample= usr/jim/a.text
goes to usr directory, then jim which is in usr and then in jim is the a.text file
pwd- command which tells user of the current directory that they are in
Special files in unix
Direct interfaces to i/o devices
i/o devices including but not limited to things such as keyboards, terminals all have special files
usually liv in the /dev directory
File systems
NTFS- more reliable than fat!
Extx- default in linux based systems
HFS- MAC OS
Analysing these
File system category- info about system as a whole
Content- information inside ordinary files
Metadata- info about file and location stored
Filename category- info about file naming
Application- journal information
Implementation of a linux based os
Inode table
Block table
Superblock- begins 1024 bytes from start of file system- 1024 bytes long
Contains global info about file system, including block size
Blocks-each file allocated a whole number of blocks
Block size is minimum space allocated for any non-empty file
Inodes- every file has exactly one inode
Means of referring to file or directory
Fixed-size
Inodes contain attributes including file, owner and permissions as well as references to blocks that hold content- useful for finding files
So
Contents of inode 2 could be stored in blocks 1 4 and 5
Directories
Has its own inode
Remember . means current directory
.. is parent
So can see the inodes of the files within the directory
Directory entries contain inodes (metadata) which contain reference to content blocks
Physical organisation
Each directory contains a pointer to next entry in directoryPhysical organisation
No of bytes from start of this entry to start of next
Deleted files are “skipped over”- may have details remaining even after deletion!
a.text
b.text
c.text
if b deleted then info remains but directory skips it and goes to C
So basically in inode table 2 there is the .directory which has inode number 471
So going to that inode will show the current “.” As 471 and then “..” which is the parent directory-
471 contains ref to passwd which is inode 893
Going to 893 will give start of text of the password file
Allocation
Allocation
System is divided up into many block groups, used to improve locality of allocation of blocks and inodes
Each group has its own tables of inodes and blocks
Which can be allocated or unallocated state
Comments
Post a Comment