1
- 1
11: File Syst em Basics
Last Modif ied: 6/ 15/ 2004 12:12:09 PM
- 2
File Syst ems
Last t ime we t alked about disk int ernals Despit e complex int ernals, disks export a
simple array of sect ors
How do we go f rom t hat t o a f ile syst em? What do we exact ly do we expect f rom a
f ile syst em?
- 3
File Syst em Basics
FS are probably t he OS abst ract ion t hat
average user is most f amiliar wit h
Files Dir ect or ies Access cont r ols (owner s, gr oups, per missions)
- 4
Files
A f ile is a collect ion of dat a wit h syst em
maint ained pr oper t ies like
Owner, size, name, last read/ writ e t ime, et c.
Files of t en have “t ypes” which allow user s and
applicat ions t o r ecognize t heir int ended use
Some f ile t ypes ar e under st ood by t he f ile syst em
(mount point , symbolic link, dir ect or y)
Some f ile t ypes ar e under st ood by applicat ions
and user s (.t xt , .j pg, .ht ml, .doc, … )
Could t he syst em underst and t hese t ypes and cust omize
it s handling?
- 5
Basic File Operat ions
UNI X
cr eat e (name)
- pen (name, mode)
r ead (f d) writ e(f d) sync(f d) seek(f d, pos) close(f d) unlink (name) r ename (old, new)
Windows
Creat eFile (name, CREATE) Creat eFile (name, OPEN) ReadFile (handle) Wr it eFile (handle) FlushFileBuf f er s(handle) Set FilePoint er (handle) CloseHandle(handl ) Delet eFile(name) CopyFile (name) MoveFile(name)
- 6
Direct ories
Dir ect or ies pr ovide a way f or user s t o or ganize
t heir f iles *and* a convenient way f or user s t o ident if y and shar e dat a
Logically dir ect or ies st or e inf or mat ion like f ile
name, size, modif icat ion t ime et c (Not always kept in t he dir ect or y t hough..)
Most f ile syst ems suppor t hier ar chical dir ect or ies
(/ usr/ local/ bin or C:\ WI NNT)
P
eople like t o organize inf ormat ion hierarchically Recall: OS of t en r ecor ds a cur r ent wor king
dir ect or y f or each pr ocess
Can t heref ore ref er t o f iles by absolut e and relat ive